1#下载源码
2> go get github.com/golang/lint/
3#编译包并生产可执行文件到bin目录下($GOPATH/bin)
4> go install github.com/golang/lint/golint
Settings
打开设置
External Tools
并新建+
选择External Tools并新建+
1Name : golint #Tool名称
2Description: golint #Tool描述
3Program : $GOPATH\bin\golint.exe #选择golint可执行文件的位置
4Atguments: $FilePath$ #魔法变量(执行当前go文件的路径)
5Working directory: $ProjectFileDir$ #魔法变量(当前项目的路径)
新增快捷键
设置快捷键
测试结果
提交代码测试
注意:这是 commit
提交之后才进行代码检测
Settings
打开设置
File Watchers
-> +
-> 分别点击安装go fmt
、goimports
、gometalinter
image.png
Ctrl+S
就可以看到效果了
gofmt 、 goimports直接就可以看见代码修改的效果
gometalinter的效果
gometalinter
> go tool vet global/init.go
测试结果
go vet
1> go tool vet ../zlsc_image
测试结果
1>go tool vet ../zlsc_image
2..\zlsc_image\global\init.go:144: struct field c_ip has json tag but is not exported
3..\zlsc_image\global\init.go:145: struct field college_id has json tag but is not exported
4..\zlsc_image\global\init.go:146: struct field status has json tag but is not exported
5..\zlsc_image\global\init.go:147: struct field camera_status has json tag but is not exported
6..\zlsc_image\global\init.go:148: struct field sign_status has json tag but is not exported
7..\zlsc_image\utils\file.go:160: Println call has possible formatting directive %s
8..\zlsc_image\utils\file.go:172: Println call has possible formatting directive %s
9..\zlsc_image\utils\file.go:184: Println call has possible formatting directive %s
10..\zlsc_image\utils\image.go:89: unreachable code
11..\zlsc_image\utils\image.go:79: image/jpeg.Options composite literal uses unkeyed fields
12..\zlsc_image\utils\pic.go:388: unreachable code
13..\zlsc_image\utils\uid.go:57: result of fmt.Sprintf call not used
14..\zlsc_image\utils\uid.go:61: result of fmt.Sprintf call not used
15..\zlsc_image\utils\uid.go:70: result of fmt.Sprintf call not used
16..\zlsc_image\utils\uid.go:98: result of fmt.Sprintf call not used
17..\zlsc_image\utils\convert\map.go:182: unreachable code
18..\zlsc_image\utils\convert\map.go:196: unreachable code
19..\zlsc_image\utils\convert\map.go:210: unreachable code
20..\zlsc_image\utils\convert\map.go:224: unreachable code
版权申明:内容来源网络,版权归原创者所有。除非无法确认,我们都会标明作者及出处,如有侵权烦请告知,我们会立即删除并表示歉意。谢谢。