diff --git a/pkg/codegen/main.go b/pkg/codegen/main.go index deb2ad28..8a4f4d2a 100644 --- a/pkg/codegen/main.go +++ b/pkg/codegen/main.go @@ -20,7 +20,7 @@ import ( func main() { controllergen.Run(args.Options{ ImportPackage: "github.com/rancher/wrangler/v2/pkg/generated", - OutputPackage: "github.com/rancher/wrangler/pkg/generated", + OutputPath: "github.com/rancher/wrangler/pkg/generated", Boilerplate: "scripts/boilerplate.go.txt", Groups: map[string]args.Group{ v1.GroupName: { diff --git a/pkg/controller-gen/args/args.go b/pkg/controller-gen/args/args.go index b771bda8..2ef413e2 100644 --- a/pkg/controller-gen/args/args.go +++ b/pkg/controller-gen/args/args.go @@ -6,7 +6,7 @@ import ( ) type CustomArgs struct { - Package string + OutputPath string ImportPackage string TypesByGroup map[schema.GroupVersion][]*types.Name Options Options @@ -15,7 +15,7 @@ type CustomArgs struct { type Options struct { ImportPackage string - OutputPackage string + OutputPath string Groups map[string]Group Boilerplate string } diff --git a/pkg/controller-gen/generators/client_generator.go b/pkg/controller-gen/generators/client_generator.go index 2e4e717b..b24ea153 100644 --- a/pkg/controller-gen/generators/client_generator.go +++ b/pkg/controller-gen/generators/client_generator.go @@ -114,7 +114,7 @@ func (cg *ClientGenerator) typesGroupVersionPackage(name *types.Name, gv schema. } func (cg *ClientGenerator) groupPackage(group string, generatorArgs *args.GeneratorArgs, customArgs *args2.CustomArgs) generator.Package { - packagePath := filepath.Join(customArgs.Package, "controllers", groupPackageName(group, customArgs.Options.Groups[group].OutputControllerPackageName)) + packagePath := filepath.Join(customArgs.OutputPath, "controllers", groupPackageName(group, customArgs.Options.Groups[group].OutputControllerPackageName)) return Package(generatorArgs, packagePath, func(context *generator.Context) []generator.Generator { return []generator.Generator{ FactoryGo(group, generatorArgs, customArgs), @@ -124,7 +124,7 @@ func (cg *ClientGenerator) groupPackage(group string, generatorArgs *args.Genera } func (cg *ClientGenerator) groupVersionPackage(gv schema.GroupVersion, generatorArgs *args.GeneratorArgs, customArgs *args2.CustomArgs) generator.Package { - packagePath := filepath.Join(customArgs.Package, "controllers", groupPackageName(gv.Group, customArgs.Options.Groups[gv.Group].OutputControllerPackageName), gv.Version) + packagePath := filepath.Join(customArgs.OutputPath, "controllers", groupPackageName(gv.Group, customArgs.Options.Groups[gv.Group].OutputControllerPackageName), gv.Version) return Package(generatorArgs, packagePath, func(context *generator.Context) []generator.Generator { generators := []generator.Generator{ diff --git a/pkg/controller-gen/generators/group_interface_go.go b/pkg/controller-gen/generators/group_interface_go.go index df33cac9..fe4a1a0c 100644 --- a/pkg/controller-gen/generators/group_interface_go.go +++ b/pkg/controller-gen/generators/group_interface_go.go @@ -39,7 +39,7 @@ func (f *interfaceGo) Imports(context *generator.Context) []string { } pkg := f.customArgs.ImportPackage if pkg == "" { - pkg = f.customArgs.Package + pkg = f.customArgs.OutputPath } packages = append(packages, fmt.Sprintf("%s \"%s/controllers/%s/%s\"", gv.Version, pkg, groupPackageName(gv.Group, f.customArgs.Options.Groups[gv.Group].OutputControllerPackageName), gv.Version)) diff --git a/pkg/controller-gen/main.go b/pkg/controller-gen/main.go index 6aeb3d91..b0ab82f7 100644 --- a/pkg/controller-gen/main.go +++ b/pkg/controller-gen/main.go @@ -33,7 +33,7 @@ func Run(opts cgargs.Options) { ImportPackage: opts.ImportPackage, Options: opts, TypesByGroup: map[schema.GroupVersion][]*types.Name{}, - Package: opts.OutputPackage, + OutputPath: opts.OutputPath, } genericArgs := args.Default().WithoutDefaultFlagParsing() genericArgs.CustomArgs = customArgs @@ -129,7 +129,7 @@ func copyGoPathToModules(customArgs *cgargs.CustomArgs) error { } } - pkg := sourcePackagePath(customArgs, customArgs.Package) + pkg := sourcePackagePath(customArgs, customArgs.OutputPath) pathsToCopy[pkg] = true for pkg := range pathsToCopy { @@ -209,7 +209,7 @@ func generateClientset(groups map[string]bool, customArgs *cgargs.CustomArgs) er args, clientSetArgs := csargs.NewDefaults() clientSetArgs.ClientsetName = "versioned" args.OutputBase = customArgs.OutputBase - args.OutputPackagePath = filepath.Join(customArgs.Package, "clientset") + args.OutputPackagePath = filepath.Join(customArgs.OutputPath, "clientset") args.GoHeaderFilePath = customArgs.Options.Boilerplate var order []schema.GroupVersion @@ -309,10 +309,10 @@ func generateInformers(groups map[string]bool, customArgs *cgargs.CustomArgs) er } args, clientSetArgs := infargs.NewDefaults() - clientSetArgs.VersionedClientSetPackage = filepath.Join(customArgs.Package, "clientset/versioned") - clientSetArgs.ListersPackage = filepath.Join(customArgs.Package, "listers") + clientSetArgs.VersionedClientSetPackage = filepath.Join(customArgs.OutputPath, "clientset/versioned") + clientSetArgs.ListersPackage = filepath.Join(customArgs.OutputPath, "listers") args.OutputBase = customArgs.OutputBase - args.OutputPackagePath = filepath.Join(customArgs.Package, "informers") + args.OutputPackagePath = filepath.Join(customArgs.OutputPath, "informers") args.GoHeaderFilePath = customArgs.Options.Boilerplate for gv, names := range customArgs.TypesByGroup { @@ -334,7 +334,7 @@ func generateListers(groups map[string]bool, customArgs *cgargs.CustomArgs) erro args, _ := lsargs.NewDefaults() args.OutputBase = customArgs.OutputBase - args.OutputPackagePath = filepath.Join(customArgs.Package, "listers") + args.OutputPackagePath = filepath.Join(customArgs.OutputPath, "listers") args.GoHeaderFilePath = customArgs.Options.Boilerplate for gv, names := range customArgs.TypesByGroup {