1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | https: //golang .org /doc/install 下载好后,通过FTPS,传递到Linux里去,放哪里随便你自己,因为被墙了,所以在Windows通过旋风下载了这个玩意儿。 你也可以: wget https: //storage .googleapis.com /golang/go1 .5.linux-amd64. tar .gz // 将go解压到 /opt ,个人喜好罢了 [root@localhost ~] # tar -C /opt -xzf ./go1.5.linux-amd64.tar.gz /*在末尾增加一下两行, GOPATH是工作目录, GOROOT表示指出go的根目录位置 ps :在自定义程序的安装位置后,需要设置这个 export GOROOT= /opt/go export PATH=$PATH:$GOROOT /bin <br> export GOPATH=$HOME /goTest */ [root@localhost ~] # vim /etc/profile [root@localhost ~] # source /etc/profile [root@localhost ~] # mkdir ./goTest/src/test [root@localhost test ] # touch ./hello.go 写入内容到hello.go: package main import "fmt" func main() { fmt .Printf( "hello, world\n" ) } [root@localhost src] # cd .. // 出现这个错误了,叫我们设置一个.go文件安装后,生成的可执行二进制文件存储在哪个目录,这个通过GOBIN设置地址, export GOBIN=$GOPATH /bin 把这段写到 /etc/profile 的后面去吧。 [root@localhost src] # go install test/hello.go go install : no install location for .go files listed on command line (GOBIN not set ) [root@localhost src] # source /etc/profile [root@localhost src] # go install test/hello.go [root@localhost src] # $GOBIN/hello hello, world 到这里,你的go就算安装好了。 |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· 软件产品开发中常见的10个问题及处理方法
· Vite CVE-2025-30208 安全漏洞
· MQ 如何保证数据一致性?
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(四):结合BotSharp