5步搭建GO环境
Easy Go Programming Setup for Windows
Dec 23, 2014
I’ve had to do this more than once recently, so I figured I’d document the simple steps for setting up the Go programming language on Windows. Most of this is simple and straightforward. The only tricky part I found is setting up your GOPATH, which defines a convention for storing and building Go code you write and acquire from open source code repositories.
5 Simple Steps
Follow these five simple steps to install Go.
- Make sure you have both Git download and Mercurial download installed. With Go programming you’ll make heavy use of open source repositories.
- Download and install the latest 64-bit Go MSI distributable (which sets most of the environmental variables for you). https://golang.org/dl/
To make things simple, use the default installation path at C:Go
- Ensure the Go binaries (found in
C:Gobin
) are in yourPath
system environment variables. To check clickSystem
,Advanced system settings
,Environment Variables...
and openPath
underSystem variables
:
An easy way to confirm is to open the command line and type go version
:
- Setup your Go workspace. This consists of three folders at the root:
bin/ pkg/ src/
I create a
C:ProjectsGo
folder as my root Go workspace:
- Create the GOPATH environment variable and reference your Go workspace path. To add, click
System
,Advanced system settings
,Environment Variables...
and clickNew...
underSystem variables
:
Set the variable name to GOPATH
and value to your Go workspace path (e.g. C:ProjectsGo
):
You can quickly check to ensure your path has been set by opening the command line and typing echo %GOPATH%
and check the output:
And that’s all it takes! You’re ready to get started.
Verify
Want to quickly test and ensure this is all working as expected? Open the command line and type the following:
go get github.com/golang/example/hello
%GOPATH%/bin/hello
You should see the output as “Hello, Go examples!” (refreshingly, not your typical hello world):
I hope this helps!
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 《闲扯Redis六》Redis五种数据类型之Hash型
- rocketmq学习2
- Python全栈(八)Flask项目实战之1.项目搭建
- 一起来读开源项目的代码-Agar.io为例
- C语言入门系列之11.文件和文件操作
- 自己动手改造 Jetpack LiveData
- FastDFS基于Docker安装
- 用Python实现批量高效文件处理 解放你的双手
- Windows下使用VS2013编译使用SDL库
- C语言经典习题100例(一)1-5
- C语言经典习题100例(二)6-10
- Python 快速验证代理IP是否有效
- C语言入门系列之6.一维和二维数组
- C语言经典习题100例(五)21-25
- Python 列表 使用技巧