Delete some dead code and fix nits.

This commit is contained in:
jregan
2019-01-29 11:59:00 -08:00
parent 93515517b8
commit 35daae1715
10 changed files with 30 additions and 263 deletions

View File

@@ -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)

View File

@@ -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 {