我是靠谱客的博主 霸气小霸王,这篇文章主要介绍Error: go install: no install location for .go files listed on command line (GOBIN not set)e.g.go installgo build,现在分享给大家,希望可以做个参考。

文章目录

  • e.g.
  • go install
  • go build

e.g.

当前目录结构

  • src
    • hello
      • Hello.go

go install

go install src/hello/Hello.go 编译 会出现以下错误

go install: no install location for .go files listed on command line (GOBIN not set)

这是因为对单个文件使用go install,就会出现这个错误

应该用 go install hello 编译
就会编译出 bin/hello 文件

之后用 ./bin/hello 运行

go build

go build hello 会编译出 hello在当前目录下

此时 运行 hello 无法运行, 必须用 ./hello

最后

以上就是霸气小霸王最近收集整理的关于Error: go install: no install location for .go files listed on command line (GOBIN not set)e.g.go installgo build的全部内容,更多相关Error:内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(107)

评论列表共有 0 条评论

立即
投稿
返回
顶部