Delete some unnecessary parameter passing.

This commit is contained in:
Jeffrey Regan
2018-10-18 10:59:46 -07:00
parent 66bbae586f
commit 2b0e2725f9
24 changed files with 65 additions and 112 deletions

View File

@@ -19,9 +19,8 @@ package fs
import (
"fmt"
"path/filepath"
"sort"
"sigs.k8s.io/kustomize/pkg/constants"
"sort"
)
var _ FileSystem = &FakeFS{}
@@ -54,13 +53,6 @@ configMapGenerator: []
secretGenerator: []
`
// WriteTestKustomization writes a standard test file.
func (fs *FakeFS) WriteTestKustomization() {
fs.WriteFile(
constants.KustomizationFileName,
[]byte(kustomizationContent))
}
// Create assures a fake file appears in the in-memory file system.
func (fs *FakeFS) Create(name string) (File, error) {
f := &FakeFile{}
@@ -123,6 +115,10 @@ func (fs *FakeFS) ReadFile(name string) ([]byte, error) {
return nil, fmt.Errorf("cannot read file %q", name)
}
func (fs *FakeFS) ReadTestKustomization() ([]byte, error) {
return fs.ReadFile(constants.KustomizationFileName)
}
// WriteFile always succeeds and does nothing.
func (fs *FakeFS) WriteFile(name string, c []byte) error {
ff := &FakeFile{}
@@ -131,6 +127,16 @@ func (fs *FakeFS) WriteFile(name string, c []byte) error {
return nil
}
// WriteTestKustomization writes a standard test file.
func (fs *FakeFS) WriteTestKustomization() {
fs.WriteTestKustomizationWith([]byte(kustomizationContent))
}
// WriteTestKustomizationWith writes a standard test file.
func (fs *FakeFS) WriteTestKustomizationWith(bytes []byte) {
fs.WriteFile(constants.KustomizationFileName, bytes)
}
func (fs *FakeFS) pathMatch(path, pattern string) bool {
match, _ := filepath.Match(pattern, path)
return match