Go语言学习笔记-01开发环境搭建
下载地址
https://go.dev/dl/
windows平台
1.依据零碎位数下载对应安装包,64位下载amd64.msi
结尾的文件,32位下载386.msi
结尾的文件
2.双击关上安装包,一路Next,期待装置完结
3.关上终端,输出go version
,若装置胜利,会有以下输入
4.设置GOPROXY
环境变量,减速go库的下载
在终端输出
go env -w https://mirrors.aliyun.com/goproxy/,https://goproxy.cn,https://goproxy.io,direct
查看设置后果
go env
编辑环境搭建
Goland
1.下载地址
https://www.jetbrains.com.cn/...
抉择2022.1.4版本,默认收费30天试用
依据零碎抉择对应安装包
2.装置完后关上,注册一个账号
3.关上编辑器
3.点击New Project,抉择Go(GOPATH),创立一个我的项目
4.装置主题插件
点击左上角File->Settings,找到Plugins
搜寻Atom Material Icons
,点击Install
搜寻One Dark theme
,点击Install
设置主题,字体,字体大小
5.hello world
右键gotrip
新建目录ch01
,并在ch01
下创立main.go
文件
输出以下代码
package mainimport "fmt"func main() { fmt.Print("hello world,咸鱼一下")}
点击运行
运行后果
第二种运行办法
在终端输出
go run ch01/main.go
第三种运行办法
在终端输出
go build ch01/main.go
此时会编译出一个执行文件main.exe
在终端输出
./main.exe
笔记地址
gitee:https://gitee.com/xianyuyixia...
github:https://github.com/xianyuyixi...
交流学习
微信号:xianyuyixia
微信公众号:闲渔一下