Created
May 2, 2023 18:13
-
-
Save kirillshevch/4d087f6a60fd9c164cee8176e0e2d3c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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