### 1、gofmt、goimports 格式化
---

```
gofmt
格式化代码
goimports
会自动把依赖包按首字母排序,并对包进行分组管理,通过空行隔开,默认分为本地包(标准库、内部包)、第三方包。
标准包永远位于最上面的第一组。
内部包是指不能被外部 import 的包,如 GoPath 模式下的包名或者非域名开头的当前项目的 GoModules 包名。
带域名的包名都属于第三方包,如 git.code.oa.com/xxx/xxx,github.com/xxx/xxx,不用区分是否是当前项目内部的包。
goimports 默认最少分成本地包和第三方包两大类,这两类包必须分开不能放在一起。本地包或者第三方包内部可以继续按实际情况细分不同子类。
```
### 2、liveTemplates
---

>goland的live template可以降低大量重复的编码
### 3、快速填充struct
---

操作步骤:
1. 把您的光标放在{}中间
2. Alt/Option + Enter
3. 选择Fill Struct 或者 Fill Struct Recursively(递归填充)
### 4、快速struct工厂方法
---

操作步骤:
1. 光标移动到struct 名称上
2. Alt/Option + Enter
3. Generate Constructor
4. 选择属性
### 5、快速生成TestCase文件
---

需要`go get golang.org/x/tools/imports` `go get github.com/cweill/gotests`支持
操作步骤:
1. 光标移动到Method/Function上
2. Command/Control+Shift+T
### 6、proto文件格式化
---
- 安装clang-formar
```
brew install clang-format
# 安装成功后,可通过此命令知道clang-format路径,后面需要用到:
which clang-format
```
- 配置Goland

Arguments填的内容:
```
-style="{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0, AlignConsecutiveAssignments: true, AlignConsecutiveAssignments: true}"
-i
$FilePath$
```

Goland 配置记录