英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论