zoukankan      html  css  js  c++  java
  • ubunut install golang

    ubunut install golang

    来源 https://www.cnblogs.com/dream397/p/13535058.html

    参考 https://golang.google.cn/

    If you're using Ubuntu 18.04 LTS or 20.04 LTS on amd64, arm64, armhf or i386, then you can use the longsleep/golang-backports PPA and update to Go 1.15.

    sudo add-apt-repository ppa:longsleep/golang-backports
    sudo apt update
    sudo apt install golang-go
    

    Note that golang-go installs latest Go as default Go. If you do not want that, install golang-1.15 instead and use the binaries from /usr/lib/go-1.15/bin.

    If that's too new for you, try: (Ubuntu 19.04 max)

    $ sudo add-apt-repository ppa:gophers/archive
    $ sudo apt update
    $ sudo apt install golang-1.11-go
    

    Note that golang-1.11-go puts binaries in /usr/lib/go-1.11/bin. If you want them on your PATH, you need to make that change yourself.

    Using snaps also works quite well:

    $ sudo snap install --classic go
    

    A restart may or may not be required for the command to be recognized depending on your system.

    Using getgo (proof-of-concept command-line installer for Go):

    curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer
    GO111MODULE=""
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/home/lsgx/.cache/go-build"
    GOENV="/home/lsgx/.config/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOINSECURE=""
    GOMODCACHE="/home/lsgx/go/pkg/mod"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="linux"
    GOPATH="/home/lsgx/go"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/usr/lib/go-1.15"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    AR="ar"
    CC="gcc"
    CXX="g++"
    CGO_ENABLED="1"
    GOMOD=""
    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-build522554850=/tmp/go-build -gno-record-gcc-switches"
    export GOROOT="/usr/lib/go-1.15"
    export PATH=$PATH:$GOROOT/bin
    
    export GO111MODULE=on
    export GOPROXY="https://goproxy.cn"
    
    go env -w GO111MODULE=on
    go env -w GOPROXY=https://goproxy.cn,direct

    =========== End

  • 相关阅读:
    Java-io流入门到精通详细总结
    Java网络编程总结
    递归--逆波兰表达式
    递归--N皇后问题
    递归--汉诺塔问题 (Hanoi)
    递归--求n!的阶乘结果
    枚举--熄灯问题
    枚举--假币问题
    枚举--生理周期
    枚举--完美立方Python算法实现
  • 原文地址:https://www.cnblogs.com/lsgxeva/p/14166439.html
Copyright © 2011-2022 走看看