go-kod / kod

A generics based dependency injection application framework for Go, support OpenTelemetry trace/metric/log natively 🚀🚀🚀
https://pkg.go.dev/github.com/go-kod/kod
Apache License 2.0
106 stars 3 forks source link

task `generate:struct2interface` is invalid #152

Closed ccoVeille closed 4 weeks ago

ccoVeille commented 4 weeks ago
$ task generate:struct2interface
task: Task "install:mockgen" is up to date
task: [generate:struct2interface] go run ./cmd/kod struct2interface .
2024/06/08 08:25:25 Loading input failed: tests/case1/kod_gen_interface.go:46:7: failed parsing arguments: tests/case1/kod_gen_interface.go:46:10: unknown package "echo"
panic: mockgen error: exit status 1

goroutine 1 [running]:
github.com/samber/lo.must({0x7b1d80, 0xc0004983c0}, {0x0, 0x0, 0x0})
    /home/whatever/go/pkg/mod/github.com/samber/lo@v1.39.0/errors.go:53 +0x1df
github.com/samber/lo.Must0(...)
    /home/whatever/go/pkg/mod/github.com/samber/lo@v1.39.0/errors.go:72
github.com/go-kod/kod/cmd/kod/internal.init.func4(0xb8a660, {0xc000032420?, 0x4?, 0x81a17c?})
    /home/whatever/Documents/dev/perso/kod/cmd/kod/internal/struct2interface.go:379 +0xa9
github.com/spf13/cobra.(*Command).execute(0xb8a660, {0xc0000323e0, 0x1, 0x1})
    /home/whatever/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xb8a380)
    /home/whatever/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
    /home/whatever/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/go-kod/kod/cmd/kod/internal.Execute()
    /home/whatever/Documents/dev/perso/kod/cmd/kod/internal/root.go:33 +0x1a
main.main()
    /home/whatever/Documents/dev/perso/kod/cmd/kod/main.go:6 +0xf
exit status 2
task: Failed t

mockgen is installed, but code expects the github.com/labstack/echo/v4 to be imported

so it should depend on task mod

ccoVeille commented 4 weeks ago

The problem was related to #153 apparently