GOLANG配置

根据操作系统下载对应的软件包

https://golang.google.cn/dl/

GOROOT就是go的安装路径

 

vim /etc/profile,在末尾加上三行

```

export GOROOT=/usr/local/go
export GOPATH=/home/go
export PATH=$PATH:$GOROOT

 

```

 

在~/.bashrc中添加下面语句:

export GOROOT=/usr/local/go
export GOPATH=/Users/workspaces
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

如果要上述设置生效, 可以执行命令: source ~/.bashrc

 

在hello.go中输入:

package main

import "fmt"

func main() {

      fmt.Println("Hello, GO !")

}

 

  • export GOROOT=/usr/local/go
  • export GOPATH=/home/go
  • export PATH=$PATH:$GOROOT
posted @ 2020-02-12 03:00  enumx  阅读(162)  评论(0编辑  收藏  举报