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 broken because of `examples/infra/redis/kod_gen_interface.go` #153

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:30:42 Loading input failed: examples/infra/redis/kod_gen_interface.go:11:8: failed parsing returns: examples/infra/redis/kod_gen_interface.go:11:12: unknown package "redis"
panic: mockgen error: exit status 1

goroutine 1 [running]:
github.com/samber/lo.must({0x7b1d80, 0xc000417610}, {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 to run task "generate:struct2interface": exit status 1

infra/redis package imports "github.com/redis/go-redis/v9"

but Go reports the file as missing, calling task mod doesn't solve issue

ccoVeille commented 4 weeks ago

"github.com/redis/go-redis/v9" imported as redis conflicts with the infra/redis package