archLinux 快速搭建golang开发环境
#安装配置codeserver
plaintext
yay -S code-server
sudo systemctl enable --now code-server@$USER
默认地址:http://127.0.0.1:8080
配置文件在~/.config/code-server/config.yaml
简单修改允许外网访问,并在路由做好端口转发 或者nginx ssl代理
plaintext
bind-addr: 0.0.0.0:8080
auth: password
password: 密码
cert: false
重启
plaintext
sudo systemctl restart code-server@$USER
#安装go
建议手动安装 :https://dev.leiyanhui.com/c/ubuntu-install-golang/
pacman 安装也可以sudo pacman -S go
#非root用户的处理
plaintext
cd ~
mkdir .gocache
编辑 /etc/profile 或者用户目录下.profile文件
plaintext
export GOCACHE=/home/用户名/.gocache
完整内容
plaintext
export GO111MODULE=on
export GOROOT=/opt/go
export GOPATH=/opt/gopath
#export GOCACHE=/opt/gocache
export GOCACHE=/home/用户名/.gocache
export GOPROXY=https://proxy.golang.com.cn,direct
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#配置codeserver的go插件
注意点,如当前用户权限不够,需要su到root下执行,sudo执行 会有网络超时的问题
https://dev.leiyanhui.com/codeserver/vscode-golang-err-gocache/
#测试一个项目
plaintext
mkdir golang && cd golang
git clone https://github.com/joyanhui/webdavgo.git
su #切换到root
go get golang.org/x/net/webdav #webdav
coderserver 打开运行测试