63

Go语言基础、进阶、提高课程--第一节:环境安装

 5 years ago
source link: http://www.10tiao.com/html/415/201807/2649839232/2.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


干货来了!!!为了让更多的小伙伴喜欢Golang、加入Golang之中来,Golang语言社区发起人彬哥联合业界大牛共同推出了Go语言基础、进阶、提高课程,目前已在网易云课堂限时特价分享,希望有兴趣的朋友们多多分享和支持!

      

以下是Go语言基础、进阶、提高课程--第一节:环境安装的部分文本教案,具体详细视频课程请扫描文章下方图片二维码或点击阅读原文!


一  GO语言安装


     https://golang.google.cn/dl/
UNIX/Linux/Mac OS X, 和 FreeBSD 安装

以下介绍了在UNIX/Linux/Mac OS X, 和 FreeBSD系统下使用源码安装方法:


1、下载源码包:go1.4.linux-amd64.tar.gz。

2、将下载的源码包解压至 /usr/local目录。

  • tar -C /usr/local -xzf go1.10.3.linux-amd64.tar.gz

[color=rgb(51, 102, 153) !important]
3、将 /usr/local/go/bin 目录添加至PATH环境变量:

  • export PATH=$PATH:/usr/local/go/bin

[color=rgb(51, 102, 153) !important]


Windows 系统下安装

Windows 下可以使用 .msi 后缀(在下载列表中可以找到该文件,如 go1.10.3.windows-amd64.msi)的安装包来安装。

默认情况下.msi文件会安装在 c:\Go 目录下。你可以将 c:\Go\bin 目录添加到 PATH 环境变量中。添加后你需要重启命令窗口才能生效。


安装测试

创建工作目录 C:\>Go_WorkSpace。

文件名: test.go,代码如下:

  • package main


  • import "fmt"


  • func main() {

  •    fmt.Println("Hello, World!")

  • }


[color=rgb(51, 102, 153) !important]
使用 go 命令执行以上代码输出结果如下:

  • C:\Go_WorkSpace>go run test.go


  • Hello, World!


[color=rgb(51, 102, 153) !important]
MAC 下可通过 brew 安装

  • brew install go


  • 或者


  • brew install golang


[color=rgb(51, 102, 153) !important]
在安装之前也可以通过 brew info go 查看版本信息

  • ~  brew info go

  • go: stable 1.10.1 (bottled), HEAD

  • Open source programming language to build simple/reliable/efficient software

  • https://golang.org

  • Not installed....


  • ~  brew info golang

  • go: stable 1.10.1 (bottled), HEAD

  • Open source programming language to build simple/reliable/efficient software

  • https://golang.org

  • Not installed


[color=rgb(51, 102, 153) !important]



二 Go编译器选择


     1 liteIDE 
     2 goland


三 Go语言工程目录结构说明





长按扫描下方二维码或点击阅读原文,即可了解课程详情!





About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK