您的位置:首页 > 编程语言 > Go语言

go语言学习

2022-01-07 00:09 671 查看

 

go语言的介绍

 

 

 

 

 

安装go的环境

官网sdk,相当于Python的解释器的意思:

l 官网:https://golang.google.cn/

l go中文在线文档:https://studygolang.com/pkgdoc

 

 

有最新版和稳定版

 

 

 

windows使用.msi一键安装

1. SDK目录介绍

1. 安装开发工具

GOPATH:go的代码存这里面

src: 存放源代码

pkg:存一些中间文件

bin:存放二进制文件的目录

pycharm官网下载:

 

 

 

 

 

 

Golang的开发团队制定了统一的官方代码风格,并且推出了gofmt工具(gofmt或go fmt)来帮助开发者格式化他们的代码到统一的风格。gofmt是一个cli程序,会优先读取标准输入,如果传入了文件路径的话,会格式化这个文件,如果传入一个目录,会格式化目录中所有.go文件,如果不传参数,会格式化当前目录下的所有.go文件。

gofmt默认不对代码进行简化,使用-s参数可以开启简化代码功能

C:\Users\Administrator>go help fmt
usage: go fmt [-n] [-x] [packages]

Fmt runs the command 'gofmt -l -w' on the packages named
by the import paths. It prints the names of the files that are modified.

For more about gofmt, see 'go doc cmd/gofmt'.
For more about specifying packages, see 'go help packages'.

The -n flag prints commands that would be executed.
The -x flag prints commands as they are executed.

The -mod flag's value sets which module download mode
to use: readonly or vendor. See 'go help modules' for more.

To run gofmt with specific options, run gofmt itself.

See also: go fix, go vet.

C:\Users\Administrator>go fmt xxx.go

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: