如何修复 “File is not `goimports`-ed with -local” 的问题?

huangapple go评论102阅读模式
英文:

How do I fix File is not `goimports`-ed with -local?

问题

如何修复这个错误?

pkg/path/to/file.go:22: 文件没有使用 -local github.com/some/repositiory (goimports) 进行 goimports
        s "github.com/some/repositiory/pkg/somepkg"

如果我运行 goimports -local pkg/path/to/file.go,程序似乎会卡住,什么都不会发生。

s 是我用来引用 somepkg 的名称,例如 s.SomeFunc()

英文:

How do I fix this error?

pkg/path/to/file.go:22: File is not `goimports`-ed with -local github.com/some/repositiory (goimports)
        s "github.com/some/repositiory/pkg/somepkg"

If I run goimports -local pkg/path/to/file.go the program just seems to get stuck and nothing happens.

s is the name I use to refer to somepkg, e.g. s.SomeFunc().

答案1

得分: 1

你需要运行以下命令:

goimports -w -local github.com/some/repositiory pkg/path/to/file.go
英文:

You have to run

goimports -w -local github.com/some/repositiory pkg/path/to/file.go

huangapple
  • 本文由 发表于 2022年9月22日 21:00:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/73815109.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定