想在自己的账号下安装golang开发环境,于是这样配置:
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
cd /home/ahfu
tar -zxvf go1.14.2.linux-amd64.tar.gz
配置.bashrc
su ahfu
vi ~/.bashrc
export PATH=$PATH:/home/ahfu/go/bin
export GOROOT=/home/ahfu/go/
export GOPATH=/home/ahfu/my_go_path/
然后执行:
go get -u github.com/go-sql-driver/mysql
出现一大堆错误:
package bytes: directory "/home/ahfu/go/src/bytes" is not using a known version control system
搜了一圈没发现找到问题,于是乖乖的在root下重新安装:
参考了这篇文章:Go 语言环境安装
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
su root
tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
然后go get正常