01 Getting Started 开始
Getting Started 开始
Download the Go distribution 下载go
Download GoClick here to visit the downloads page 点击这里欢迎来到go语言的下载页面
Official binary distributions are available for the FreeBSD (release 10-STABLE and above), Linux, macOS (10.10 and above), and Windows operating systems and the 32-bit (386
) and 64-bit (amd64
) x86 processor architectures.
官方二进制分布安装
If a binary distribution is not available for your combination of operating system and architecture, try installing from source or installing gccgo instead of gc. 如果二进制分发不可用于您的操作系统和体系结构的组合, 请尝试从源安装或安装 gccgo 而不是 gc。
System requirements 系统要求
Go binary distributions are available for these supported operating systems and architectures. Please ensure your system meets these requirements before proceeding. If your OS or architecture is not on the list, you may be able to install from source or use gccgo instead.
Operating system | Architectures | Notes |
---|---|---|
|
||
FreeBSD 10.3 or later | amd64, 386 | Debian GNU/kFreeBSD not supported |
Linux 2.6.23 or later with glibc | amd64, 386, arm, arm64, s390x, ppc64le |
CentOS/RHEL 5.x not supported. Install from source for other libc. |
macOS 10.10 or later | amd64 | use the clang or gcc† that comes with Xcode‡ for cgo support |
Windows 7, Server 2008R2 or later | amd64, 386 | use MinGW gcc†. No need for cygwin or msys. |
†A C compiler is required only if you plan to use cgo.
‡You only need to install the command line tools for Xcode. If you have already installed Xcode 4.3+, you can install it from the Components tab of the Downloads preferences panel.
Install the Go tools go语言工具安装
If you are upgrading from an older version of Go you must first remove the existing version.
如果从go语言旧版本更新到go语言新的版本,你必须先卸载存在的版本
Linux, macOS, 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 go$VERSION.$OS-$ARCH.tar.gz
Choose the archive file appropriate for your installation. For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux, the archive you want is called go1.2.1.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
Note: changes made to a profile
file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile
.
macOS package installer
Download the package file, open it, and follow the prompts to install the Go tools. The package installs the Go distribution to /usr/local/go
.
The package should put the /usr/local/go/bin
directory in your PATH
environment variable. You may need to restart any open Terminal sessions for the change to take effect.
Windows
The Go project provides two installation options for Windows users (besides installing from source): a zip archive that requires you to set some environment variables and an MSI installer that configures your installation automatically.
MSI installer
Open the MSI file and follow the prompts to install the Go tools. By default, the installer puts the Go distribution in c:\Go
.
The installer should put the c:\Go\bin
directory in your PATH
environment variable. You may need to restart any open command prompts for the change to take effect.
Zip archive
Download the zip file and extract it into the directory of your choice (we suggest c:\Go
).
If you chose a directory other than c:\Go
, you must set the GOROOT
environment variable to your chosen path.
Add the bin
subdirectory of your Go root (for example, c:\Go\bin
) to your PATH
environment variable.
Setting environment variables under Windows
Under Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.
Test your installation 测试你是否安装成功
Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.
Create your workspace directory, $HOME/go
. (If you'd like to use a different directory, you will need to set the GOPATH
environment variable.)
Next, make the directory src/hello
inside your workspace, and in that directory create a file named hello.go
that looks like:
package main import "fmt" func main() {
fmt.Printf("hello, world\n")
}
Then build it with the go
tool:
$ cd $HOME/go/src/hello
$ go build
The command above will build an executable named hello
in the directory alongside your source code. Execute it to see the greeting:
$ ./hello
hello, world
If you see the "hello, world" message then your Go installation is working.
You can run go
install
to install the binary into your workspace's bin
directory or go
clean
-i
to remove it.
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 卸载go
To remove an existing Go installation from your system delete the go
directory. This is usually /usr/local/go
under Linux, macOS, 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 macOS 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 help, see the list of Go mailing lists, forums, and places to chat.
Report bugs either by running “go
bug
”, or manually at the Go issue tracker.
01 Getting Started 开始的更多相关文章
- 01.SQLServer性能优化之----强大的文件组----分盘存储
汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 文章内容皆自己的理解,如有不足之处欢迎指正~谢谢 前天有学弟问逆天:“逆天,有没有一种方 ...
- 用Kotlin创建第一个Android项目(KAD 01)
原文标题:Create your first Android project using Kotlin (KAD 01) 作者:Antonio Leiva 时间:Nov 21, 2016 原文链接:h ...
- Java企业实训 - 01 - Java前奏
前言: 虽然个人专攻.NET方向,不过由于个人是干教育行业的,方方面面的东西,不能说都必须精通,但肯定多少都会涉及到. 一个菜鸟学员,从啥都不会,经过一步步学习,最后到企业上手掌管一个模块甚至一个项目 ...
- Node.js 教程 01 - 简介、安装及配置
系列目录: Node.js 教程 01 - 简介.安装及配置 Node.js 教程 02 - 经典的Hello World Node.js 教程 03 - 创建HTTP服务器 Node.js 教程 0 ...
- 0042 MySQL学习笔记-入门--01
基本概念: 数据库DB(database): 数据的仓库,数据的集合,是数据的一种结构化的存储 数据库管理系统DBMS(database management system): 管理数据库的一套软件 ...
- Android快乐贪吃蛇游戏实战项目开发教程-01项目概述与目录
一.项目简介 贪吃蛇是一个很经典的游戏,也很适合用来学习.本教程将和大家一起做一个Android版的贪吃蛇游戏. 我已经将做好的案例上传到了应用宝,无病毒.无广告,大家可以放心下载下来把玩一下.应用宝 ...
- ArtifactTransferException: Failure to transfer org.apache.openejb:javaee-api:jar:5.0-1
最近在myeclipse上创建maven类型的web项目的时候,出现了一个错误. ArtifactTransferException: Failure to transfer org.apache.o ...
- Python学习--01入门
Python学习--01入门 Python是一种解释型.面向对象.动态数据类型的高级程序设计语言.和PHP一样,它是后端开发语言. 如果有C语言.PHP语言.JAVA语言等其中一种语言的基础,学习Py ...
- 异步编程系列第01章 Async异步编程简介
p { display: block; margin: 3px 0 0 0; } --> 2016.10.11补充 三个月过去了,回头来看,我不得不承认这是一系列失败的翻译.过段时间,我将重新翻 ...
- 【干货分享】前端面试知识点锦集01(HTML篇)——附答案
一.HTML部分 1.浏览器页面有哪三层构成,分别是什么,作用是什么? 构成:结构层.表示层.行为层分别是:HTML.CSS.JavaScript作用:HTML实现页面结构,CSS完成页面的表现与风格 ...
随机推荐
- NetApp常用巡检命令
常用检查命令 environment status 查看环境信息 version 查看OS版本 sysconfig -v 查看系统信息(设备序列号 系统软.硬件信息等) sysconfig -a 查看 ...
- GreatSct -应用程序白名单bypass工具
0x00 GreatSCT简介 GreatSCT目前得到了@ConsciousHacker的支持,该项目名为Great SCT(Great Scott).Great SCT是一个用于生成应用程序白 ...
- MySQL 第六篇:数据备份、pymysql模块
一 IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具 下载链接:https://pan.baidu.com/s/1O8hXkdRK5_EVHZwNPwjCB ...
- MySQL 第八篇:ORM框架SQLAlchemy
一 介绍 SQLAlchemy是Python编程语言下的一款ORM框架,该框架建立在数据库API之上,使用关系对象映射进行数据库操作,简言之便是:将对象转换成SQL,然后使用数据API执行SQL并获取 ...
- Python如何引入自定义模块?
Python运行环境在查找库文件时是对 sys.path 列表进行遍历,如果我们想在运行环境中注册新的类库,主要有以下四种方法: 1.在sys.path列表中添加新的路径.这里可以在运行环境中直接修改 ...
- Docker应用四:搭建docker镜像仓库(包括自生成https证书、登陆认证)
利用docker官网提供的registry镜像创建私有仓库 一.首先从docker官网拉取registry镜像: docker pull registry 二.然后运行该镜像: docker run ...
- Cloudstack系统配置(三)
系统配置 CloudStack提供一个基于web的UI,管理员和终端用户能够使用这个界面.用户界面版本依赖于登陆时使用的凭证不同而不同.用户界面是适用于大多数流行的浏览器包括IE7,IE8,IE9,F ...
- 在MyBatis中,前台传数组批量传id处理数据方式
<update id = "dishBatchSaleOrDown"> <if test="ids != null"> <if t ...
- bzoj千题计划129:bzoj2007: [Noi2010]海拔
http://www.lydsy.com/JudgeOnline/problem.php?id=2007 1.所有点的高度一定在0~1之间, 如果有一个点的高度超过了1,那么必定会有人先上坡,再下坡, ...
- php中的几个常用的魔术常量
在php中我们可以自定义常量,同时php中也自定义了一些好用的常量,这些常量会根据其所在的位置而自动变化. 我们称之为魔术常量.魔术常量可以大写也可以小写,是不区分大小写的 __FIL ...