美文网首页Linux成长库我爱编程
go语言环境搭建(基于go1.8)

go语言环境搭建(基于go1.8)

作者: 泡菜爱上WaSabi | 来源:发表于2018-06-26 17:21 被阅读10次
tar -xvf go1.8.3.linux-amd64.tar.gz -C $GO_INSTALL_DIR

4.添加环境变量vim /etc/profile,加入如下几行

export PATH=$PATH:$GO_INSTALL_DIR/go/bin

export GOROOT= $GO_INSTALL_DIR/go

export GOBIN=$GOROOT/bin

export GOPATH= $GO_INSTALL_DIR/go/data  注意 $GO_INSTALL_DIR 为你的go的安装或者解压目录

5.生效环境变量

source /etc/profile
  • 然后执行go
[root@centos ~] go
Go is a tool for managing Go source code.

Usage:

    go command [arguments]

The commands are:

    build       compile packages and dependencies
    clean       remove object files
    doc         show documentation for package or symbol
    env         print Go environment information
    bug         start a bug report
    fix         run go tool fix on packages
    fmt         run gofmt on package sources
    generate    generate Go files by processing source
    get         download and install packages and dependencies
    install     compile and install packages and dependencies
    list        list packages
    run         compile and run Go program
    test        test packages
    tool        run specified go tool
    version     print Go version
    vet         run go tool vet on packages

Use "go help [command]" for more information about a command.

Additional help topics:

    c           calling between Go and C
    buildmode   description of build modes
    filetype    file types
    gopath      GOPATH environment variable
    environment environment variables
    importpath  import path syntax
    packages    description of package lists
    testflag    description of testing flags
    testfunc    description of testing functions

Use "go help [topic]" for more information about that topic.

看到以上信息,说明go环境已经搭建起来

  • 查看go的版本
[root@centos ~] go version
go version go1.8 linux/amd64

相关文章

网友评论

    本文标题:go语言环境搭建(基于go1.8)

    本文链接:https://www.haomeiwen.com/subject/xnegdftx.html