Question. Context: "Like I'm Gonna Lose You" is a song recorded by American singer and songwriter Meghan Trainor for her first studio album Title (2015). The song features American singer John Legend. It was written by Trainor, Justin Weaver, and Caitlyn Smith, and produced by Chris Gelbuda and Trainor. Released by Epic Records on June 23, 2015, as Trainor's fourth and final single from the album, it is a soul song. Lyrically, it is an optimistic and inspiring love song with a theme of fatalism and conveys the message to not take time with loved ones for granted.

Question: who wrote like i'm going to lose you?
Answer. Trainor
What step-by-step reasoning justifies that answer?
Reasoning: The relevant sentence in the passage is: It was written by Trainor, Justin Weaver, and Caitlyn Smith, and produced by Chris Gelbuda and Trainor.