Skip to content

Instantly share code, notes, and snippets.

@mjarkk
Created April 8, 2025 07:41
Show Gist options
  • Save mjarkk/80227d44118acf3556dd8ace1ad55cbe to your computer and use it in GitHub Desktop.
Save mjarkk/80227d44118acf3556dd8ace1ad55cbe to your computer and use it in GitHub Desktop.
func main() {
os.Remove("prompt.txt")
promptFile, err := os.Create("prompt.txt")
if err != nil {
log.WithError(err).Fatal("Error creating prompt.txt")
}
defer promptFile.Close()
err = filepath.WalkDir("go-backend", func(path string, d fs.DirEntry, err error) error {
if !strings.HasSuffix(path, ".go") {
return nil
}
contents, err := os.ReadFile(path)
if err != nil {
return nil
}
fmt.Fprintln(promptFile)
fmt.Fprintln(promptFile, "---------------------------------")
fmt.Fprintln(promptFile, "File:", path)
fmt.Fprintln(promptFile, string(contents))
return nil
})
if err != nil {
log.WithError(err).Fatal("Error walking the path")
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment