Skip to content

Commit 411f27a

Browse files
committed
Add go:generate for helpgen
This adds a go:generate comment to controller-gen's entrypoint to generate help, so we should just be able to run go:generate to regenerate.
1 parent ddfdd9d commit 411f27a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd/controller-gen/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import (
3333
"sigs.k8s.io/controller-tools/pkg/webhook"
3434
)
3535

36+
//go:generate go run ../helpgen/main.go paths=../../pkg/... generate:headerFile=../../boilerplate.go.txt,year=2019
37+
3638
// Options are specified to controller-gen by turning generators and output rules into
3739
// markers, and then parsing them using the standard registry logic (without the "+").
3840
// Each marker and output rule should thus be usable as a marker target.

cmd/helpgen/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (Generator) Help() *markers.DefinitionHelp {
204204
}
205205

206206
func usage() {
207-
fmt.Fprintln(os.Stderr, "usage: help-gen generate:headerFile=./hack/boilerplate.go.txt,year=2019 paths=./pkg/...")
207+
fmt.Fprintf(os.Stderr, "usage: %s generate:headerFile=./boilerplate.go.txt,year=2019 paths=./pkg/...\n", os.Args[0])
208208

209209
optInfo := help.ByCategory(optionsRegistry, help.SortByOption)
210210
for _, cat := range optInfo {

0 commit comments

Comments
 (0)