Disable go vet checks for “composite literal uses unkeyed fields”

邮差的信 提交于 2019-12-02 22:12:15
$ go doc cmd/vet

By default all checks are performed. If any flags are explicitly set to true, only those tests are run. Conversely, if any flag is explicitly set to false, only those tests are disabled. Thus -printf=true runs the printf check, -printf=false runs all checks except the printf check.

Unkeyed composite literals

Flag: -composites

Composite struct literals that do not use the field-keyed syntax.
OneOfOne

You can disable it or you can fix the code instead:

a := A{B: b}

playground

go tool vet -composites=false .

You can disable it with the -composites=false flag: e.g.,

go vet -composites=false .

NB: go tool vet is deprecated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!