Golang学习系列第一天:安装golang

 

0.  ssh链接linux(我用的centos7),略

1.  golang下载

因为Golang官网https://golang.org/国内没法直接访问,故能够到Go语言中文网下载:https://studygolang.com/dl,可根据本身的电脑操做系统下载对应的版本,我下载的是go1.14.4.linux-amd64.tar.gz最新(当前时间)安装包,不过也能够直接点击下面这个连接直接下载https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz,即linux

[root@master dgm]# wget https://dl.google.com/go/go1.14.4.linux-amd64.tar.gz

2.  golang安装

     解压golang压缩文件golang

[root@master dgm]# tar -zxvf go1.14.4.linux-amd64.tar.gz

配置环境变量,编辑/etc/profile文件,即vim  /etc/profilevim

追加如下内容:windows

golang配置

保存该配置文件centos

而后重载配置 source /etc/profile 使之生效bash

最后查看是否生效dom

go version

  go版本检查

3.  helloworld测试

新建hello.go文件ssh

touch hello.go

而后编辑该hello.go文件,键入如下内容ide

package main

import "fmt"

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

退出保存测试

而后在命令行执行go run hello.go,能够看到以下结果

 

 helloworld

参考:

  1. https://gomirrors.org/
  2. https://studygolang.com/dl
  3. CentOS7安装golang1.6环境  http://www.javashuo.com/article/p-yqhqvian-gm.html

  4. 你不再用设置 GOROOT 了  https://zhuanlan.zhihu.com/p/93776289

  5. Golang 1.13: 解决国内 go get 没法下载的问题  https://www.sunzhongwei.com/problem-of-domestic-go-get-unable-to-download

  6. https://goproxy.io/zh/
  7. Golang Guide: A List of Top Golang Frameworks, IDEs, and Tools  https://dzone.com/articles/golang-guide-a-list-of-top-golang-frameworks-ides
相关文章
相关标签/搜索