- 使用go (< 11.1):
go install github.com/MarioCarrion/nit/cmd/nit或下载一个预编译的版本。 - 使用go(>=1.11)。
GO111MODULE=on go get github.com/MarioCarrion/nit/cmd/nit@v0.6.0, - 使用retool:
retool add github.com/MarioCarrion/nit/cmd/nit v0.6.0。
我还在Reddit社区分享了这个工具,我从评论中得到的感受是,如果能支持标准的代码组织,代码或多或少地被组织起来就好了。
type Foo struct{}
func NewFoo() *Foo { return &Foo{} }
func (f *Foo) Run() {}
type Bar struct{}
func NewBar() *Bar { return &Bar{} }
func (b *Bar) Run() {}
实际上我也不反对这种风格,我一定会在不久的将来加入支持。