mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Utilize go generate
Use 'go generate' for auto-generating code. Drop the old 'mock' and 'apigen' makefile targets. Those are replaced with a single make generate which (re-)generates everything.
This commit is contained in:
parent
16139ae1f5
commit
9487fbeb18
5 changed files with 48 additions and 9 deletions
13
Makefile
13
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')
|
||||
|
|
|
@ -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"
|
||||
|
|
20
pkg/labeler/doc.go
Normal file
20
pkg/labeler/doc.go
Normal file
|
@ -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
|
20
pkg/topologyupdater/doc.go
Normal file
20
pkg/topologyupdater/doc.go
Normal file
|
@ -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
|
|
@ -16,6 +16,8 @@ limitations under the License.
|
|||
|
||||
package source
|
||||
|
||||
//go:generate mockery --name=LabelSource --inpkg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue