奇怪的编译错误提示“没有可构建的Go源文件”

3
基本上,在 client.go 中,我会像这样导入一个包:
pb "github.com/wilbyang/gotham-grpc/search"

当我尝试运行go run client.go时,我遇到了以下错误:
“/Users/wilbyang/goPath/src/github.com/wilbyang/gotham-grpc/search”中没有可构建的Go源文件。
我的gopath是:
“/Users/wilbyang/goPath/”。
我确信目录$GOPATH/src/github.com/wilbyang/gotham-grpc/search存在,并且在该目录下存在通过protoc生成的search.pb.go文件,包名为search。我真的不明白为什么会出现这种情况,已经苦恼了好几个小时!有谁能帮我解决这个问题吗?

1
你的文件中可能存在语法错误。 - I159
search.pb.go文件中的包名是什么? - JimB
包名为 'search'。 - David
@David 如果你进入 $GOPATH/src/github.com/wilbyang/gotham-grpc/search 并执行 go build,会得到什么结果? - Topo
1个回答

0

go run client.go 只在 client.go 文件有 main 函数时有效。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接