Skip to content

Commit

Permalink
Merge pull request #436 from aylei/issue-435
Browse files Browse the repository at this point in the history
Fix go vet error 'composite literal uses unkeyed fields' in generated code
  • Loading branch information
k8s-ci-robot committed Nov 7, 2019
2 parents bd248da + b2ef212 commit 7bc7887
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/apiregister-gen/generators/versioned_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ var (
{{ $api.Group }}.Internal{{ $api.Kind }}Status,
func() runtime.Object { return &{{ $api.Kind }}{} }, // Register versioned resource
func() runtime.Object { return &{{ $api.Kind }}List{} }, // Register versioned resource list
&{{ $api.Group }}.{{ $api.StatusStrategy }}{builders.StatusStorageStrategySingleton},
&{{ $api.Group }}.{{ $api.StatusStrategy }}{DefaultStatusStorageStrategy: builders.StatusStorageStrategySingleton},
),{{ end -}}
{{ range $subresource := $api.Subresources -}}
Expand All @@ -105,7 +105,7 @@ var (
func() runtime.Object { return &{{ $subresource.Request }}{} }, // Register versioned resource
nil,
{{ if $subresource.REST }}{{ $api.Group }}.New{{ $subresource.REST }}{{ else -}}
func(generic.RESTOptionsGetter) rest.Storage { return &{{ $api.Group }}.{{ $subresource.Kind }}REST{ {{$api.Group}}.New{{$api.Kind}}Registry({{$api.Group}}.{{$api.Group|public}}{{$api.Kind}}Storage) } },
func(generic.RESTOptionsGetter) rest.Storage { return &{{ $api.Group }}.{{ $subresource.Kind }}REST{Registry: {{$api.Group}}.New{{$api.Kind}}Registry({{$api.Group}}.{{$api.Group|public}}{{$api.Kind}}Storage) } },
{{ end -}}
),
{{ end -}}
Expand Down
5 changes: 3 additions & 2 deletions cmd/apiserver-boot/boot/create/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ var admissionControllerTemplate = `
package {{ lower .Kind }}admission
import (
"context"
aggregatedadmission "{{.Repo}}/plugin/admission"
aggregatedinformerfactory "{{.Repo}}/pkg/client/informers_generated/externalversions"
aggregatedclientset "{{.Repo}}/pkg/client/clientset_generated/clientset"
Expand Down Expand Up @@ -502,11 +503,11 @@ func (p *{{ lower .Kind }}Plugin) ValidateInitialization() error {
return nil
}
func (p *{{ lower .Kind }}Plugin) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterface) error {
func (p *{{ lower .Kind }}Plugin) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error {
return nil
}
func (p *{{ lower .Kind }}Plugin) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterface) error {
func (p *{{ lower .Kind }}Plugin) Validate(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error {
return nil
}
Expand Down
5 changes: 4 additions & 1 deletion example/basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@

all: test

test: build
test: build check
go test ./pkg/...
bash -c "find pkg/apis/ -name apiserver.local.config | xargs rm -rf"

check:
go vet $$(go list ./... | grep -vE '(clientset|listers|informers)_generated')

build: cmds
bin/apiserver-boot build executables --vendor-dir ../../

Expand Down
5 changes: 4 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ all: test

NON_INTERACTIVE_FLAG=--skip-resource=false --skip-controller=false --skip-admission-controller=false

test: build
test: build check
go test ./pkg/...
bash -c "find pkg/apis/ -name apiserver.local.config | xargs rm -rf"

check: build
go vet $$(go list ./... | grep -vE '(clientset|listers|informers)_generated')

skeleton: cmds
apiserver-boot init repo --domain sample.kubernetes.io
apiserver-boot create group version resource --group storage --version v1 --kind VolumeClaim $(NON_INTERACTIVE_FLAG)
Expand Down

0 comments on commit 7bc7887

Please sign in to comment.