ubuntu16.04 安装go

GO下载:
            https://golang.google.cn/dl/
ubuntu16.04 安装go_第1张图片
安装:
         sudo tar -xvf go1.10.3.linux-amd64.tar.gz -C /opt/
配置:sudo vim /etc/profile
         export GOROOT=/opt/go
         export GOPATH=/home/ubuntu/gocode
         export PATH=$PATH:$GOROOT/bin:/$GOPATH/bin
source /etc/profile
查看版本:
        go version
                  go version go1.10.3 linux/amd64
go环境变量查看
ubuntu@vm:~$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ubuntu/gocode"
GORACE=""
GOROOT="/opt/go"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build659898395=/tmp/go-build -gno-record-gcc-switches"


VSCode安装:  code_1.28.2-1539735992_amd64.deb
        sudo dpkg -i code_1.28.2-1539735992_amd64.deb
        卸载:dpkg -r 包名
VSCode 配置:
ubuntu16.04 安装go_第2张图片

ubuntu16.04 安装go_第3张图片

VScode设置语言:
Ctrl+Shift+p  搜索 Configure Display Language
修改如下:
{
    // Defines VS Code's display language.
    // See https://go.microsoft.com/fwlink/?LinkId=761051 for a list of supported languages.
    
    //"locale":"en" // Changes will not take effect until VS Code has been restarted.
    "locale":"zh-CN" // Changes will not take effect until VS Code has been restarted.
}
设置代理:
ubuntu16.04 安装go_第4张图片

{
    "http.proxy": "https://127.0.0.1:1080",
    "files.autoSave": "onFocusChange",
    "go.buildOnSave": true,
    "go.lintOnSave": true,
    "go.vetOnSave": true,
    "go.buildTags": "",
    "go.buildFlags": [],
    "go.lintFlags": [],
    "go.vetFlags": [],
    "go.coverOnSave": false,
    "go.useCodeSnippetsOnFunctionSuggest": false,
    "go.formatOnSave": true,
    "go.formatTool": "goreturns",
    "go.goroot": "/opt/go",
    "go.gopath": "/home/ubuntu/gocode",
    "go.gocodeAutoBuild": false
}

你可能感兴趣的:(go)