在Linux中安装Go包

huangapple go评论85阅读模式
英文:

installing go packages in linux

问题

我是GO的新手,刚刚安装了适用于Linux AMD64的最新版本,但是尽管我可以运行go命令,但似乎无法获取、构建或安装任何命令。

go get bufio
package bufio: 无法识别的导入路径 "bufio"

有什么想法吗?

英文:

I am new at GO and just installed the latest version available for Linux AMD64, but although I can run go commands, I don't seem to be able to get, build or install any commands.

go get bufio
package bufio: unrecognized import path "bufio"

Any ideas?

答案1

得分: 10

“bufio”是标准库的一部分。你不能“go get”它。但是不用担心,任何标准和支持的安装过程都会安装这个包(就像整个stdlib一样),所以不需要“go get”它。

只需在想要使用其导出声明的包中包含

import "bufio";

它应该“只是工作”;-)

英文:

Package "bufio" is part of the standard library. You cannot "go get" it. But no worry, any standard and supported installation procedure makes this package installed (as is the whole stdlib), so there's no need to "go get" it.

Just include

import "bufio"

in a package where you want to use its exported decalarations and it should "just work" 在Linux中安装Go包

答案2

得分: 3

你是否按照安装说明中所描述的设置了GOROOT和GOBIN两个环境变量?

顺便问一下,你是从源码安装的还是使用发布的tarball安装的?

英文:

Did you set both the GOROOT and GOBIN environmental variables as described in the installation instructions?

BTW, did you install it from source or the release tarball?

huangapple
  • 本文由 发表于 2013年4月8日 23:18:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/15882876.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定