mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 18:10:59 +00:00
Renaming to better name
This commit is contained in:
@@ -50,68 +50,71 @@ type FileSystem interface {
|
||||
Walk(path string, walkFn filepath.WalkFunc) error
|
||||
}
|
||||
|
||||
// FileSystemWithOnDiskDefault satisfies the FileSystem interface by forwarding
|
||||
// FileSystemOrOnDisk satisfies the FileSystem interface by forwarding
|
||||
// all of its method calls to the given FileSystem whenever it's not nil.
|
||||
// If it's nil, the call is forwarded to the OS's underlying file system.
|
||||
type FileSystemWithOnDiskDefault struct {
|
||||
type FileSystemOrOnDisk struct {
|
||||
FileSystem FileSystem
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) fs() FileSystem {
|
||||
// Set sets the given FileSystem as the target for all the FileSystem method calls.
|
||||
func (fs *FileSystemOrOnDisk) Set(f FileSystem) { fs.FileSystem = f }
|
||||
|
||||
func (fs FileSystemOrOnDisk) fs() FileSystem {
|
||||
if fs.FileSystem != nil {
|
||||
return fs.FileSystem
|
||||
}
|
||||
return MakeFsOnDisk()
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Create(path string) (File, error) {
|
||||
func (fs FileSystemOrOnDisk) Create(path string) (File, error) {
|
||||
return fs.fs().Create(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Mkdir(path string) error {
|
||||
func (fs FileSystemOrOnDisk) Mkdir(path string) error {
|
||||
return fs.fs().Mkdir(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) MkdirAll(path string) error {
|
||||
func (fs FileSystemOrOnDisk) MkdirAll(path string) error {
|
||||
return fs.fs().MkdirAll(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) RemoveAll(path string) error {
|
||||
func (fs FileSystemOrOnDisk) RemoveAll(path string) error {
|
||||
return fs.fs().RemoveAll(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Open(path string) (File, error) {
|
||||
func (fs FileSystemOrOnDisk) Open(path string) (File, error) {
|
||||
return fs.fs().Open(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) IsDir(path string) bool {
|
||||
func (fs FileSystemOrOnDisk) IsDir(path string) bool {
|
||||
return fs.fs().IsDir(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) ReadDir(path string) ([]string, error) {
|
||||
func (fs FileSystemOrOnDisk) ReadDir(path string) ([]string, error) {
|
||||
return fs.fs().ReadDir(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) CleanedAbs(path string) (ConfirmedDir, string, error) {
|
||||
func (fs FileSystemOrOnDisk) CleanedAbs(path string) (ConfirmedDir, string, error) {
|
||||
return fs.fs().CleanedAbs(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Exists(path string) bool {
|
||||
func (fs FileSystemOrOnDisk) Exists(path string) bool {
|
||||
return fs.fs().Exists(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Glob(pattern string) ([]string, error) {
|
||||
func (fs FileSystemOrOnDisk) Glob(pattern string) ([]string, error) {
|
||||
return fs.fs().Glob(pattern)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) ReadFile(path string) ([]byte, error) {
|
||||
func (fs FileSystemOrOnDisk) ReadFile(path string) ([]byte, error) {
|
||||
return fs.fs().ReadFile(path)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) WriteFile(path string, data []byte) error {
|
||||
func (fs FileSystemOrOnDisk) WriteFile(path string, data []byte) error {
|
||||
return fs.fs().WriteFile(path, data)
|
||||
}
|
||||
|
||||
func (fs FileSystemWithOnDiskDefault) Walk(path string, walkFn filepath.WalkFunc) error {
|
||||
func (fs FileSystemOrOnDisk) Walk(path string, walkFn filepath.WalkFunc) error {
|
||||
return fs.fs().Walk(path, walkFn)
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
@@ -137,11 +138,13 @@ github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHN
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
|
||||
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
|
||||
Reference in New Issue
Block a user