goalng 文件编译报错:
pkg/service/esqueryapi/wire_gen.go:18:6: `NewEsImpl` redeclared in this block (typecheck)
func NewEsImpl(logger *zap.SugaredLogger, cfg *ArgsConfig) *Impl {
^
pkg/service/esqueryapi/init_config.go:86:6: other declaration of NewEsImpl (typecheck)
func NewEsImpl(logger *zap.SugaredLogger, cfg *ArgsConfig) *Impl {
^
pkg/service/esqueryapi/wire_gen.go:29:6: `Impl` redeclared in this block (typecheck)
type Impl struct {
^
pkg/service/esqueryapi/init_config.go:13:6: other declaration of Impl (typecheck)
type Impl struct {
^
pkg/service/esqueryapi/wire_gen.go:34:7: `mapping` redeclared in this block (typecheck)
const mapping = `
^
pkg/service/esqueryapi/init_config.go:18:7: other declaration of mapping (typecheck)
const mapping = `
^
make: *** [lint] Error 1
解决:
需要在对应的go文件的开头处添加"//+build wireinject":
//+build wireinject
package esqueryapi
...
即可。