Thanks Matt 2016-08-23 9:56 GMT+08:00 Matt Harden <matt.har...@gmail.com>:
> cluster.ImageFilterOptions has an embedded field of type > types.ImageListOptions. When fields are embedded, the field name is set to > the type. So you can write: > > groupImages := make(map[string]apitypes.Image) > opts := cluster.ImageFilterOptions{ > ImageListOptions: apitypes.ImageListOptions{ > All: boolValue(r, "all"), > MatchName: r.FormValue("filter"), > Filters: filters, > }, > } > > > On Mon, Aug 22, 2016 at 6:35 PM tommy xiao <xia...@gmail.com> wrote: > >> the go vet always report composite literal uses unkeyed fields warning, >> >> $ go vet `go list ./...|grep -v /vendor/` >> api/handlers.go:189: github.com/docker/swarm/cluster.ImageFilterOptions >> composite literal uses unkeyed fields >> exit status 1 >> scheduler/filter/dependency_test.go:60: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:69: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:78: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:87: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:96: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:105: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:160: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:169: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:178: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:187: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:241: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> scheduler/filter/dependency_test.go:252: >> github.com/docker/swarm/cluster.ContainerConfig composite literal uses >> unkeyed fields >> exit status 1 >> >> >> the source code is : >> >> groupImages := make(map[string]apitypes.Image) >> opts := cluster.ImageFilterOptions{ >> apitypes.ImageListOptions{ // <--- here >> All: boolValue(r, "all"), >> MatchName: r.FormValue("filter"), >> Filters: filters, >> }, >> } >> >> i found the annoy warning and the fix way is not cover this case. anyone >> can clarify which way can elegant to remove it. anyone can do me a favor. >> thanks a lot. >> >> -- >> Deshi Xiao >> Twitter: xds2000 >> E-mail: xiaods(AT)gmail.com >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- Deshi Xiao Twitter: xds2000 E-mail: xiaods(AT)gmail.com -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.