You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package vetrepro
typeContainerstruct {
ListStringList
}
// StringList is a list of stringstypeStringList []string
And a foo_test.go:
package vetrepro_test
import"github.com/prashantv/vetrepro"// This causes a failurevar_=&vetrepro.Container{
List: vetrepro.StringList{"hello", "world", "asdasd", "asdasd"},
}
// This works even though it's essentially the same.varlist= vetrepro.StringList{"hello", "world", "asdasd", "asdasd"}
var_=&vetrepro.Container{
List: list,
}
What did you expect to see?
No errors from go vet for both places were I create vetrepro.StringList.
What did you see instead?
An error for the first case (where the StringList is created inline when setting the List field), but no error for the second case, where the StringList is created separately from the Container.
$ go vet .
foo_test.go:7: vetrepro.StringList composite literal uses unkeyed fields
If the issue is that vet needs the installed packages, I'd expect that both cases would be affected. go install does fix this issue, but I'm not clear why the error is inconsistent between the 2 cases.
The text was updated successfully, but these errors were encountered:
In the move to go1.6, using a declared type as a slice shows up as an
error in go vet:
```
routing_table/schema/endpoint/endpoint_utils_test.go:130:
tcp_routes.TCPRoutes composite literal uses unkeyed fields
```
This error will be fixed in go1.7:
golang/go#15408
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?As above, darwin + amd64. Running OSX 10.11.4
Ran
go vet
for the following code:https://github.com/prashantv/vetrepro
Basically has a
foo.go
with:And a
foo_test.go
:No errors from
go vet
for both places were I createvetrepro.StringList
.An error for the first case (where the
StringList
is created inline when setting theList
field), but no error for the second case, where theStringList
is created separately from theContainer
.If the issue is that
vet
needs the installed packages, I'd expect that both cases would be affected.go install
does fix this issue, but I'm not clear why the error is inconsistent between the 2 cases.The text was updated successfully, but these errors were encountered: