mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Delete some dead code and fix nits.
This commit is contained in:
@@ -29,15 +29,15 @@ import (
|
||||
"sigs.k8s.io/kustomize/pkg/target"
|
||||
)
|
||||
|
||||
// BuildOptions contain the options for running a build
|
||||
type BuildOptions struct {
|
||||
// Options contain the options for running a build
|
||||
type Options struct {
|
||||
kustomizationPath string
|
||||
outputPath string
|
||||
}
|
||||
|
||||
// NewBuildOptions creates a BuildOptions object
|
||||
func NewBuildOptions(p, o string) *BuildOptions {
|
||||
return &BuildOptions{
|
||||
// NewOptions creates a Options object
|
||||
func NewOptions(p, o string) *Options {
|
||||
return &Options{
|
||||
kustomizationPath: p,
|
||||
outputPath: o,
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func NewCmdBuild(
|
||||
out io.Writer, fs fs.FileSystem,
|
||||
rf *resmap.Factory,
|
||||
ptf transformer.Factory) *cobra.Command {
|
||||
var o BuildOptions
|
||||
var o Options
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "build [path]",
|
||||
@@ -86,7 +86,7 @@ func NewCmdBuild(
|
||||
}
|
||||
|
||||
// Validate validates build command.
|
||||
func (o *BuildOptions) Validate(args []string) error {
|
||||
func (o *Options) Validate(args []string) error {
|
||||
if len(args) > 1 {
|
||||
return errors.New("specify one path to " + constants.KustomizationFileNames[0])
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (o *BuildOptions) Validate(args []string) error {
|
||||
}
|
||||
|
||||
// RunBuild runs build command.
|
||||
func (o *BuildOptions) RunBuild(
|
||||
func (o *Options) RunBuild(
|
||||
out io.Writer, fSys fs.FileSystem,
|
||||
rf *resmap.Factory, ptf transformer.Factory) error {
|
||||
ldr, err := loader.NewLoader(o.kustomizationPath, fSys)
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestBuildValidate(t *testing.T) {
|
||||
"", "specify one path to " + constants.KustomizationFileNames[0]},
|
||||
}
|
||||
for _, mycase := range cases {
|
||||
opts := BuildOptions{}
|
||||
opts := Options{}
|
||||
e := opts.Validate(mycase.args)
|
||||
if len(mycase.erMsg) > 0 {
|
||||
if e == nil {
|
||||
|
||||
Reference in New Issue
Block a user