因好奇而走进go语言,让你不在只闻其声,不见其形。

https://golang.org/doc/install;这里是go语言的官网文档。吃不透英文,终究会被限制在有限的区域,一词词的吃透。

安装包下载地址为:https://golang.org/dl/

如果打不开可以使用这个地址:https://golang.google.cn/dl/https://golang.google.cn/doc/install

想了想,具体步骤就不提了,英文内容够全了。

说一下关于SettingGOPATH的中外差别:

就像原文所说,“ If no GOPATH is set, it is assumed to be $HOME/go on Unix systems and %USERPROFILE%\go on Windows.”

那么这个GOPATH居然是在环境变量的用户变量中;

那么,原文中:

Your workspace can be located wherever you like, but we'll use C:\go-work in this example.

NOTE: GOPATH must not be the same path as your Go installation.

  • Create folder at C:\go-work.
  • Right click on "Start" and click on "Control Panel". Select "System and Security", then click on "System".
  • From the menu on the left, select the "Advanced systems settings".
  • Click the "Environment Variables" button at the bottom.
  • Click "New" from the "User variables" section.
  • Type GOPATH into the "Variable name" field.
  • Type C:\go-work into the "Variable value" field.
  • Click OK.

这段就是说将GOPATH这个环境变量的值由原来的%USERPROFILE%\go替换为你的go工作空间的目录。保存环境变量更改后,记得重启电脑是其生效(win10)。

原文中是这样使test.go生效的并测试的:

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

Create your workspace directory, %USERPROFILE%\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:

C:\> cd %USERPROFILE%\go\src\hello
C:\Users\Gopher\go\src\hello> go build

The command above will build an executable named hello.exe in the directory alongside your source code. Execute it to see the greeting:

C:\Users\Gopher\go\src\hello> 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.

但是,按旧有方式,还可在终端执行:go run hello.go

使用原文中的生成hello.exe文件得使用当前目录相对路径执行hello.exe这种方式。

更新:

1. 因为go version >= 1.13,所以go env -w GO111MODULE=on修改相应依赖模式,go env查看

个人安装GO1.13.6版本指南手册之搭建环境的更多相关文章

  1. 【linux】【Go】Centos7安装go1.13环境

    前言     Go(又称Golang)是Google开发的一种静态强类型.编译型.并发型,并具有垃圾回收功能的编程语言. 罗伯特·格瑞史莫(Robert Griesemer),罗勃·派克(Rob Pi ...

  2. centos7.5上安装go1.13.4

    一.安装 1.下载go1.13.4.linux-amd64.tar.gz 先进入官网https://golang.google.cn/ 再 https://golang.google.cn/doc/i ...

  3. 升级安装go1.13.5

    运行文件时报错 verifying github.com/mattn/go-isatty@v0.0.10-0.20190818123653-bf9a1dea1961/go.mod: github.co ...

  4. 黑苹果之DELL台式机安装Mac OS X 10.13.6版本操作系统

    由于本人所在的公司一般都是DELL的品牌台式机,所以以DELL台式机做小白鼠.记得在2012年的时候,在当时的那家公司为了学习自学IOS开发的Objective-C开发语言的时候,由于囊中羞涩买不起m ...

  5. docker探索-CentOS7中配置Docker的yum源并升级安装docker1.13(十)

    此处使用的是CentOS7,内核版本为 [root@localhost ~]# uname -r -.el7.x86_64 该版本下,配置了yum的源为阿里的镜像源,具体的配置方法可以参见阿里镜像源配 ...

  6. Kubernetes 1.13 的完整部署手册

    前言: 非常详细的K8s的完整部署手册,由于Kubernetes版本和操作系统的版本关系非常敏感,部署前请查阅版本关系对应表 地址:https://github.com/kubernetes/kube ...

  7. atitit.api设计 方法 指南 手册 v2 q929.docx

    atitit.api设计 方法 指南 手册 v2 q929.docx atitit.api设计原则与方法 1. 归一化(锤子钉子理论)1 1.1. 链式方法2 1.2. 规则5:建立返回值类型2 1. ...

  8. VMware上安装ubuntu 13.04

    作者:viczzx 出处:http://www.cnblogs.com/zixuan-zhang 欢迎转载,也请保留这段声明.谢谢! 这两天打算在Linux环境下学Python语言,想换个高点的ubu ...

  9. ROS(indigo) 安装和使用更新版本的Gazebo----3,4,5,6,7 附:中国机器人大赛中型组仿真比赛说明

    ROS(indigo) 安装和使用更新版本的Gazebo,本文以7为例. Gazebo7支持更多新的功能,如果使用下面命令安装ROS(indigo): ~$ sudo apt-get install ...

随机推荐

  1. Mongoose多表查询

    文章来自 两个表关联查询aggregate 多个表关联查询aggregate populate多表关联查询 多表查询的两个方式 一个是aggregate聚合 一个是populate Schema的外表 ...

  2. Manjaro Linux 添加源及输入法

    生成可用的中国镜像站列表 sudo pacman-mirrors -i -c China -m rank 勾选相应的镜像站 ,看自己的喜好 如中科大:http://mirrors.ustc.edu.c ...

  3. 065、Java面向对象之定义一个Book类,在主类中使用Book类

    01.代码如下: package TIANPAN; class Book { // 定义一个新的类 String title; // 书的名字 double price; // 书的价格 public ...

  4. django ORM多对多正向查询时查询返回结果为None

    表 class Books(models.Model): '''书籍''' id = models.AutoField(primary_key=True) name = models.CharFiel ...

  5. Exchange 导出用户邮箱

    应用场景: 1.需要把某个用户的邮箱内容全部导出来,提供给审计或监察部门. 2.跨平台的迁移,从第三方的邮件系统迁移到exchange.其中一种迁移方式就是把用户批量导出为PST,然后在exchang ...

  6. Html5 经验

    http://knockoutjs.com/documentation/introduction.html knockout的模式 MVVM 四大重要概念 声明式绑定UI界面自动刷新依赖跟踪模版 一些 ...

  7. 032-session函数

    <?php $username="guest1"; if(isset($username)) { session_name($username); } echo " ...

  8. ajax异步提交 有时会出现无bug的数据处理异常-----debug没有问题,正常运行却数据处理不正确,极少机会会出现正常的处理结果

    ajax  被使用时,常默认的就使用了异步处理. 当遇到后面的代码对同样的数据进行处理 或 要依赖前面ajax处理的结果时,就会导致数据处理结果不正确,未达到预期值. 且,debug时却能正常完成功能 ...

  9. Git提交出现error: src refspec master does not match any的问题

    在本地与远程分别新建了一个仓库并且关联后,想要把本地的文件提交到github上面, 输入下方命令后没有成功,而是出现了报错:error: src refspec master does not mat ...

  10. C# Stream篇(二) -- TextReader 和StreamReader

    TextReader 和StreamReader 目录: 为什么要介绍 TextReader? TextReader的常用属性和方法 TextReader 示例 从StreamReader想到多态 简 ...