x/tools/go/packages:误导性的错误信息

ztmd8pv5  于 4个月前  发布在  Go
关注(0)|答案(2)|浏览(43)

go list对GOPATH敏感,但错误信息并未告知用户如何操作。
特别是:
如果GOPATH不包含~/gostuff,则执行以下命令会失败:go list -deps=true -- ~/gostuff/foo,并显示"无法导入绝对路径"的错误信息;
如果GOPATH包含~/gostuff,则该命令可以正常执行。

rseugnpd

rseugnpd1#

go list ~/foo.go returns "command-line-arguments"
I don't know what it should return (maybe an error "~/foo.go is not a package"?)
go list -deps ~/foo.go
helpfully returns a list of packages, followed by the mysterious "command-line-arguments", which seems to be an internal made-up package name placeholder, but it's confusing.

z9ju0rcb

z9ju0rcb2#

我将指派给自己,以确保由go/packages返回的错误是清晰的,然后我会再次取消分配,以便调查/决定对go列表本身采取什么行动。

相关问题