中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

golang安裝

發布時間:2020-03-13 10:31:05 來源:網絡 閱讀:447 作者:吳之恒心 欄目:系統運維

Getting Started

  • Install the Go tools

  • Test your installation

  • Uninstalling Go

  • Getting help

Your download should begin shortly. If it does not, click this link.

Install the Go tools

If you are upgrading from an older version of Go you must first remove the existing version.

Linux, Mac OS X, and FreeBSD tarballs

Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:

tar -C /usr/local -xzf go1.7.5.linux-amd64.tar.gz

(Typically these commands must be run as root or through sudo.)

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile(for a system-wide installation) or $HOME/.profile:

export PATH=$PATH:/usr/local/go/bin
Installing to a custom location

The Go binary distributions assume they will be installed in /usr/local/go (or c:\Go under Windows), but it is possible to install the Go tools to a different location. In this case you must set the GOROOT environment variable to point to the directory in which it was installed.

For example, if you installed Go to your home directory you should add the following commands to $HOME/.profile:

export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin

NoteGOROOT must be set only when installing to a custom location.

Test your installation

Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.

Create a directory to contain your workspace, $HOME/work for example, and set the GOPATH environment variable to point to that location.

$ export GOPATH=$HOME/work

You should put the above command in your shell startup script ($HOME/.profile for example).

Next, make the directories src/github.com/user/hello inside your workspace (if you use GitHub, substitute your user name for user), and inside the hello directory create a file named hello.go with the following contents:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

Then compile it with the go tool:

$ go install github.com/user/hello

The command above will put an executable command named hello (or hello.exe) inside the bin directory of your workspace. Execute the command to see the greeting:

$ $GOPATH/bin/hellohello, world

If you see the "hello, world" message then your Go installation is working.

Before rushing off to write Go code please read the How to Write Go Code document, which describes some essential concepts about using the Go tools.

Uninstalling Go

To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go under Linux, Mac OS X, and FreeBSD or c:\Go under Windows.

You should also remove the Go bin directory from your PATH environment variable. Under Linux and FreeBSD you should edit /etc/profile or $HOME/.profile. If you installed Go with the Mac OS X package then you should remove the /etc/paths.d/go file. Windows users should read the section about setting environment variables under Windows.

Getting help

For real-time help, ask the helpful gophers in #go-nuts on the Freenode IRC server.

The official mailing list for discussion of the Go language is Go Nuts.

Report bugs using the Go issue tracker.


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

阳西县| 乌什县| 武安市| 西安市| 舒兰市| 慈利县| 公安县| 蒙自县| 石泉县| 中方县| 德保县| 淳安县| 阿鲁科尔沁旗| 荔波县| 电白县| 休宁县| 临汾市| 贡嘎县| 普陀区| 佛学| 平原县| 宜君县| 苏尼特左旗| 斗六市| 萝北县| 邹城市| 原平市| 民权县| 临海市| 洪泽县| 宿州市| 新巴尔虎左旗| 黔江区| 万宁市| 上蔡县| 虎林市| 抚宁县| 米脂县| 乐平市| 和龙市| 亚东县|