Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/llpyg/llpyg.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func main() {
// tidy go module
goModTidy(args.OutputDir)

// format go code
codeFormat(args.OutputDir)
Comment thread
luoliwoshang marked this conversation as resolved.
Outdated

fmt.Printf("LLGo bindings generated successfully in %s\n", args.OutputDir)
}

Expand Down
12 changes: 12 additions & 0 deletions cmd/llpyg/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,15 @@ func goModTidy(outDir string) error {
return nil
}
Comment thread
toaction marked this conversation as resolved.

func codeFormat(outDir string) error {
Comment thread
toaction marked this conversation as resolved.
if err := os.Chdir(outDir); err != nil {
return fmt.Errorf("error: failed to change directory: %w", err)
}
cmd := exec.Command("go", "fmt", "./...")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
return fmt.Errorf("error: failed to format Go code: %w", err)
}
return nil
}
Comment thread
toaction marked this conversation as resolved.
Loading