go - 奇怪的编译错误说 'no buildable Go source files'

标签 go

基本上,在 client.go 中我导入了这样一个包

pb "github.com/wilbyang/gotham-grpc/search"

当我尝试运行 go run client.go 时,出现错误:

no buildable Go source files in /Users/wilbyang/goPath/src/github.com/wilbyang/gotham-grpc/search".

我的路径是:

"/Users/wilbyang/goPath/".

而且我确定目录 $GOPATH/src/github.com/wilbyang/gotham-grpc/search 存在并且在该目录下 search.pb.go 存在,由 protoc 和正在搜索的包生成。我真的不明白为什么并为此苦苦挣扎了几个小时!有谁能引导我摆脱困境吗?

最佳答案

go run client.goclient.go 中有一个 main 函数时工作。

关于go - 奇怪的编译错误说 'no buildable Go source files',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42163748/

相关文章:

go - FieldA.Eq 未定义(类型 cqlc.BooleanColumn 没有字段或方法 Eq)

json - 是否有使用 json 对数组/映射进行编码的函数?

math - 将 uint8 转为 float32

python - Cloudflare KV API批量PUT-错误10012-无法将KVPair解码为中间结构

Golang多 WaitGroup 和计时器最终停止

xml - 解析xml时如何保留html标签?

go - 如何转换图像以上传 Spotify 个人资料图片?

go - 如何将值推送到嵌套的 map[string]interface{} slice 中?

regex - 如何在 golang 中使用正则表达式重命名 json 字符串中的根字段而不影响同名的内部字段?

go - 遍历具有嵌入结构的结构