@@ -38,7 +38,7 @@ func NewConfigFromFiles(paths []string) (Config, []Secret, []ConfigMap, error) {
3838
3939 err := yaml .Unmarshal (docBytes , & res )
4040 if err != nil {
41- return fmt .Errorf ("Unmarshaling doc: %s" , err )
41+ return fmt .Errorf ("unmarshaling doc: %s" , err )
4242 }
4343
4444 switch {
@@ -47,7 +47,7 @@ func NewConfigFromFiles(paths []string) (Config, []Secret, []ConfigMap, error) {
4747
4848 err := yaml .Unmarshal (docBytes , & secret )
4949 if err != nil {
50- return fmt .Errorf ("Unmarshaling secret: %s" , err )
50+ return fmt .Errorf ("unmarshaling secret: %s" , err )
5151 }
5252
5353 if s , ok := secretsNames [secret .Metadata .Name ]; ok {
@@ -63,20 +63,20 @@ func NewConfigFromFiles(paths []string) (Config, []Secret, []ConfigMap, error) {
6363
6464 err := yaml .Unmarshal (docBytes , & cm )
6565 if err != nil {
66- return fmt .Errorf ("Unmarshaling config map: %s" , err )
66+ return fmt .Errorf ("unmarshaling config map: %s" , err )
6767 }
6868 configMaps = append (configMaps , cm )
6969
7070 case res .APIVersion == knownAPIVersion && res .Kind == knownKind :
7171 config , err := NewConfigFromBytes (docBytes )
7272 config .cleanPaths ()
7373 if err != nil {
74- return fmt .Errorf ("Unmarshaling config: %s" , err )
74+ return fmt .Errorf ("unmarshaling config: %s" , err )
7575 }
7676 configs = append (configs , config )
7777
7878 default :
79- return fmt .Errorf ("Unknown apiVersion '%s' or kind '%s' for resource" ,
79+ return fmt .Errorf ("unknown apiVersion '%s' or kind '%s' for resource" ,
8080 res .APIVersion , res .Kind )
8181 }
8282 return nil
@@ -91,10 +91,10 @@ func NewConfigFromFiles(paths []string) (Config, []Secret, []ConfigMap, error) {
9191 }
9292
9393 if len (configs ) == 0 {
94- return Config {}, nil , nil , fmt .Errorf ("Expected to find at least one config, but found none" )
94+ return Config {}, nil , nil , fmt .Errorf ("expected to find at least one config, but found none" )
9595 }
9696 if len (configs ) > 1 {
97- return Config {}, nil , nil , fmt .Errorf ("Expected to find exactly one config, but found multiple" )
97+ return Config {}, nil , nil , fmt .Errorf ("expected to find exactly one config, but found multiple" )
9898 }
9999
100100 return configs [0 ], secrets , configMaps , nil
@@ -105,38 +105,38 @@ func NewConfigFromBytes(bs []byte) (Config, error) {
105105
106106 err := yaml .Unmarshal (bs , & config )
107107 if err != nil {
108- return Config {}, fmt .Errorf ("Unmarshaling config: %s" , err )
108+ return Config {}, fmt .Errorf ("unmarshaling config: %s" , err )
109109 }
110110
111111 err = config .Validate ()
112112 if err != nil {
113- return Config {}, fmt .Errorf ("Validating config: %s" , err )
113+ return Config {}, fmt .Errorf ("validating config: %s" , err )
114114 }
115115
116116 return config , nil
117117}
118118
119119func (c Config ) Validate () error {
120120 if c .APIVersion != knownAPIVersion {
121- return fmt .Errorf ("Validating apiVersion: Unknown version (known: %s)" , knownAPIVersion )
121+ return fmt .Errorf ("validating apiVersion: Unknown version (known: %s)" , knownAPIVersion )
122122 }
123123 if c .Kind != knownKind {
124- return fmt .Errorf ("Validating kind: Unknown kind (known: %s)" , knownKind )
124+ return fmt .Errorf ("validating kind: Unknown kind (known: %s)" , knownKind )
125125 }
126126
127127 if len (c .MinimumRequiredVersion ) > 0 {
128128 if c .MinimumRequiredVersion [0 ] == 'v' {
129- return fmt .Errorf ("Validating minimum version: Must not have prefix 'v' (e.g. '0.8.0')" )
129+ return fmt .Errorf ("validating minimum version: Must not have prefix 'v' (e.g. '0.8.0')" )
130130 }
131131
132132 userConstraint , err := semver .NewConstraint (">=" + c .MinimumRequiredVersion )
133133 if err != nil {
134- return fmt .Errorf ("Parsing minimum version constraint: %s" , err )
134+ return fmt .Errorf ("parsing minimum version constraint: %s" , err )
135135 }
136136
137137 vendirVersion , err := semver .NewVersion (version .Version )
138138 if err != nil {
139- return fmt .Errorf ("Parsing version constraint: %s" , err )
139+ return fmt .Errorf ("parsing version constraint: %s" , err )
140140 }
141141
142142 if ! userConstraint .Check (vendirVersion ) {
@@ -148,7 +148,7 @@ func (c Config) Validate() error {
148148 for i , dir := range c .Directories {
149149 err := dir .Validate ()
150150 if err != nil {
151- return fmt .Errorf ("Validating directory '%s' (%d): %s" , dir .Path , i , err )
151+ return fmt .Errorf ("validating directory '%s' (%d): %s" , dir .Path , i , err )
152152 }
153153 }
154154
@@ -158,7 +158,7 @@ func (c Config) Validate() error {
158158func (c Config ) AsBytes () ([]byte , error ) {
159159 bs , err := yaml .Marshal (c )
160160 if err != nil {
161- return nil , fmt .Errorf ("Marshaling config: %s" , err )
161+ return nil , fmt .Errorf ("marshaling config: %s" , err )
162162 }
163163
164164 return bs , nil
@@ -173,7 +173,7 @@ func (c Config) UseDirectory(path, dirPath string) error {
173173 continue
174174 }
175175 if matched {
176- return fmt .Errorf ("Expected to match exactly one directory, but matched multiple" )
176+ return fmt .Errorf ("expected to match exactly one directory, but matched multiple" )
177177 }
178178 matched = true
179179
@@ -192,7 +192,7 @@ func (c Config) UseDirectory(path, dirPath string) error {
192192 }
193193
194194 if ! matched {
195- return fmt .Errorf ("Expected to match exactly one directory, but did not match any" )
195+ return fmt .Errorf ("expected to match exactly one directory, but did not match any" )
196196 }
197197 return nil
198198}
@@ -220,7 +220,7 @@ func (c Config) Subset(paths []string) (Config, error) {
220220 continue
221221 }
222222 if seen {
223- return Config {}, fmt .Errorf ("Expected to match path '%s' once, but matched multiple" , entirePath )
223+ return Config {}, fmt .Errorf ("expected to match path '%s' once, but matched multiple" , entirePath )
224224 }
225225 pathsToSeen [entirePath ] = true
226226
@@ -234,7 +234,7 @@ func (c Config) Subset(paths []string) (Config, error) {
234234
235235 for path , seen := range pathsToSeen {
236236 if ! seen {
237- return Config {}, fmt .Errorf ("Expected to match path '%s' once, but did not match any" , path )
237+ return Config {}, fmt .Errorf ("expected to match path '%s' once, but did not match any" , path )
238238 }
239239 }
240240
@@ -265,7 +265,7 @@ func (c Config) checkOverlappingPaths() error {
265265 for i , path := range paths {
266266 for i2 , path2 := range paths {
267267 if i != i2 && strings .HasPrefix (path2 + string (filepath .Separator ), path + string (filepath .Separator )) {
268- return fmt .Errorf ("Expected to not manage overlapping paths: '%s' and '%s'" , path2 , path )
268+ return fmt .Errorf ("expected to not manage overlapping paths: '%s' and '%s'" , path2 , path )
269269 }
270270 }
271271 }
0 commit comments