Skip to content

Commit

Permalink
regenerate example and fix finding package
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed Aug 19, 2024
1 parent 60d4c4e commit a57f552
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/muxt/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ func generateCommand(args []string, workingDirectory string, getEnv func(string)
}
_ = os.Remove(filepath.Join(workingDirectory, g.outputFilename))
list, err := packages.Load(&packages.Config{
Mode: packages.NeedFiles | packages.NeedSyntax | packages.NeedEmbedPatterns | packages.NeedEmbedFiles,
Mode: packages.NeedName | packages.NeedFiles | packages.NeedSyntax | packages.NeedEmbedPatterns | packages.NeedEmbedFiles,
Dir: workingDirectory,
Tests: false,
}, workingDirectory)
if err != nil {
return err
}
if g.goPackage != "" {
i := slices.IndexFunc(list, func(p *packages.Package) bool { return p.ID == g.goPackage })
i := slices.IndexFunc(list, func(p *packages.Package) bool { return p.Name == g.goPackage })
if i < 0 {
return fmt.Errorf("package %s not loaded", g.goPackage)
}
Expand Down
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Row struct {

func (b *Backend) List(_ context.Context) []Row { return b.data }

//go:generate muxt generate --receiver Backend
//go:generate go run ../cmd/muxt generate --receiver-static-type Backend

func main() {
backend := &Backend{
Expand Down
6 changes: 3 additions & 3 deletions example/template_routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a57f552

Please sign in to comment.