package main import ( "encoding/csv" "os" ) func main() { file, err := os.Create("output.csv") if err != nil { panic(err) } defer file.Close() writer := csv.NewWriter(file) defer writer.Flush() rows := [][]string{ {"id", "name", "age"}, {"1", "Alice", "25"}, {"2", "Bob", "30"}, {"3", "Charlie", "35"}, } for _, row := range rows { err := writer.Write(row) if err != nil { panic(err) } } }In the code above, we create a new CSV file "output.csv" and use encoding/csv.Writer to write rows into it. We first create a slice of slices containing the data that we want to write into the file. We then initialize a new csv.Writer using the csv.NewWriter function, and flush the writer using the defer statement to ensure that all data is written to the file when the program ends. Finally, we use the Write method of csv.Writer to write each row into the file. As we can see, encoding/csv.Writer is a part of the Golang standard library, and is therefore included with any Golang installation.