Skip to content

Instantly share code, notes, and snippets.

@Ramko9999
Last active April 26, 2021 03:08
Show Gist options
  • Select an option

  • Save Ramko9999/7dfd1f55cd21c76360e75a39a5369a2c to your computer and use it in GitHub Desktop.

Select an option

Save Ramko9999/7dfd1f55cd21c76360e75a39a5369a2c to your computer and use it in GitHub Desktop.
import (
"log"
"os"
)
func writeFileContents() {
content := "Something to write";
/* os.WriteFile takes in file path, a []byte of the file content,
and permission bits in case file doesn't exist */
err := os.WriteFile("./test.txt", []byte(content), 0666);
if err != nil {
log.Fatal(err);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment