因好奇而走进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. 使用线程池测试cpu的并发计算能力

    接到一个需求是测试一下cpu并发计算能力,针对int和float求和单位时间能执行几次的问题.可能是服务器选型用到的参数. 开始使用的是fork-join,但是发现fork-join每次得到的结果值波 ...

  2. MVC 实例详解,蛮好的,适合新手

    https://blog.csdn.net/f627422467/article/category/6360437

  3. SQLlite的olestr

    关于SQLite的connection string说明:http://www.connectionstrings.com/sqlite/ SQLite GUI客户端列表:http://www.sql ...

  4. 06 MySQL运算符

    算数运算符     +    -    *    /    DIV    %    MOD   比较运算符     =    <>    !=    <=>(安全等于,NULL ...

  5. java集合简单特性

  6. 51nod 1352:集合计数

    1352 集合计数 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题  收藏  关注 给出N个固定集合{1,N},{2,N-1},{3,N-2},...,{N-1,2 ...

  7. setup factory 设置自启动

    Registry.SetValue(HKEY_LOCAL_MACHINE, "Software//Microsoft//Windows//CurrentVersion//Run", ...

  8. CSS层级关系 学习笔记

        CSS 文档流   格式化上下文 Formatting Context 即初始元素定义的环境 块格式化上下文  Block Formatting Context BFC 行内格式化上下文   ...

  9. 记一次docker使用异常

    背景: win10 docker 有几天没有用Oracle数据库,突然发现数据库挂了 docker start oracle 报错 具体错误信息: Error starting userland pr ...

  10. scala 语言特性

    Scala 语言特性 Unit 表示无值, 等价于java, C++中的void Null 表示空值或空引用 Nothing 所有其他类型的子类型, 表示没有值 Any 所有类型的超类, 任何实例都属 ...