The following snippet shows how to print the content of a slice of strings into a file, separating each string with a new line.

package main

func main() {
    var text []string

    //... fill text with string values

    // writes a slice of strings to a file, one per line
    sep := "\n"
    for _, line := range text {
        if _, err = f.WriteString(line + sep); err != nil {

Want to hire me?

I'm currently considering remote job opportunities.

I'm interested in Go and/or JavaScript senior software engineer positions.

Read more about me and if you're interested, get in touch.