Write a slice of any type to a file in Go
<p>For logging purposes I want to be able to quickly write a slice of any type, whether it be ints, strings, or custom structs, to a file in Go. For instance, in C#, I can do the following in 1 line:</p>

<pre><code>File.WriteAllLines(filePath, myCustomTypeList.Select(x =&gt; x.ToString());
</code></pre>

<p>How would I go about doing this in Go? The structs implement the <code>Stringer</code> interface.</p>

<p>Edit: I in particular would like the output to be printed to a file and one line per item in the slice </p>