diff --git a/Makefile b/Makefile index 36df7d581..0d9cb6217 100644 --- a/Makefile +++ b/Makefile @@ -98,15 +98,10 @@ templates: -e "}; /$$end/p; d }" -i deployment/helm/node-feature-discovery/values.yaml @rm nfd-worker.conf.tmp -mock: - mockery --name=LabelSource --dir=source --inpkg --note="Re-generate by running 'make mock'" - mockery --name=APIHelpers --dir=pkg/apihelper --inpkg --note="Re-generate by running 'make mock'" - mockery --name=LabelerClient --dir=pkg/labeler --inpkg --note="Re-generate by running 'make mock'" - mockery --name=NodeTopologyClient --dir=pkg/topologyupdater --inpkg --note="Re-generate by running 'make mock'" - -apigen: - protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. pkg/labeler/labeler.proto - protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. pkg/topologyupdater/topology-updater.proto +generate: + go mod vendor + go generate ./cmd/... ./pkg/... ./source/... + rm -rf vendor/ gofmt: @$(GO_FMT) -w -l $$(find . -name '*.go') diff --git a/pkg/apihelper/apihelpers.go b/pkg/apihelper/apihelpers.go index db9b37edc..d3fef4c46 100644 --- a/pkg/apihelper/apihelpers.go +++ b/pkg/apihelper/apihelpers.go @@ -16,6 +16,8 @@ limitations under the License. package apihelper +//go:generate mockery --name=APIHelpers --inpkg + import ( topologyclientset "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned" api "k8s.io/api/core/v1" diff --git a/pkg/labeler/doc.go b/pkg/labeler/doc.go new file mode 100644 index 000000000..d66c1a096 --- /dev/null +++ b/pkg/labeler/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package labeler + +//go:generate protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. labeler.proto +//go:generate mockery --name=LabelerClient --inpkg diff --git a/pkg/topologyupdater/doc.go b/pkg/topologyupdater/doc.go new file mode 100644 index 000000000..689af805c --- /dev/null +++ b/pkg/topologyupdater/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package topologyupdater + +//go:generate protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. -I . -I ../../vendor/ topology-updater.proto +//go:generate mockery --name=NodeTopologyClient --inpkg diff --git a/source/source.go b/source/source.go index e490857f5..519f16c50 100644 --- a/source/source.go +++ b/source/source.go @@ -16,6 +16,8 @@ limitations under the License. package source +//go:generate mockery --name=LabelSource --inpkg + import ( "fmt" )