Skip to content

Instantly share code, notes, and snippets.

@kirillshevch
Created May 2, 2023 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirillshevch/4d087f6a60fd9c164cee8176e0e2d3c2 to your computer and use it in GitHub Desktop.
Save kirillshevch/4d087f6a60fd9c164cee8176e0e2d3c2 to your computer and use it in GitHub Desktop.
file, err := os.Create("output.txt")
if err != nil {
log.Fatalf("Failed to create file: %s", err)
}
defer file.Close()
for key, value := range files {
line := fmt.Sprintf("%s: %s\n", key, value)
_, err := file.WriteString(line)
if err != nil {
log.Fatalf("Failed to write to file: %s", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment