Created
April 8, 2025 07:41
-
-
Save mjarkk/80227d44118acf3556dd8ace1ad55cbe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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