我正在运行我的CI工具上的vet,并开始收到错误:
composite literal uses unkeyed fields
因为我在实例化
type A struct {
*B
}
像这样:
A{b} // b is of type *B
我不关心这个警告,并希望在我的兽医检查中禁用它。我该怎么做呢?
$ go doc cmd/vet
默认情况下,执行所有检查。如果任何标志显式设置为true,则仅运行那些测试。相反,如果任何标志显式设置为false,则仅禁用那些测试。因此-printf = true运行printf检查,-printf = false运行除printf检查之外的所有检查。
Unkeyed composite literals Flag: -composites Composite struct literals that do not use the field-keyed syntax.
go tool vet -composites=false .