@@ -19,6 +19,7 @@ package loader
1919import (
2020 "bytes"
2121 "context"
22+ "errors"
2223 "fmt"
2324 "io"
2425 "os"
@@ -39,7 +40,6 @@ import (
3940 "github.com/compose-spec/compose-go/v2/types"
4041 "github.com/compose-spec/compose-go/v2/validation"
4142 "github.com/mitchellh/mapstructure"
42- "github.com/pkg/errors"
4343 "gopkg.in/yaml.v3"
4444)
4545
@@ -226,7 +226,7 @@ func parseYAML(decoder *yaml.Decoder) (map[string]interface{}, PostProcessor, er
226226 }
227227 cfgMap , ok := cfg .(map [interface {}]interface {})
228228 if ! ok {
229- return nil , nil , errors .Errorf ("Top-level object must be a mapping" )
229+ return nil , nil , errors .New ("Top-level object must be a mapping" )
230230 }
231231 converted , err := convertToStringKeysRecursive (cfgMap , "" )
232232 if err != nil {
@@ -244,7 +244,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
244244// LoadWithContext reads a ConfigDetails and returns a fully loaded configuration
245245func LoadWithContext (ctx context.Context , configDetails types.ConfigDetails , options ... func (* Options )) (* types.Project , error ) {
246246 if len (configDetails .ConfigFiles ) < 1 {
247- return nil , errors .Errorf ("No files specified" )
247+ return nil , errors .New ("No files specified" )
248248 }
249249
250250 opts := & Options {
@@ -351,7 +351,7 @@ func loadYamlModel(ctx context.Context, config types.ConfigDetails, opts *Option
351351 var raw interface {}
352352 processor := & ResetProcessor {target : & raw }
353353 err := decoder .Decode (processor )
354- if err == io .EOF {
354+ if err != nil && errors . Is ( err , io .EOF ) {
355355 break
356356 }
357357 if err != nil {
@@ -402,7 +402,7 @@ func load(ctx context.Context, configDetails types.ConfigDetails, opts *Options,
402402 for _ , f := range loaded {
403403 if f == mainFile {
404404 loaded = append (loaded , mainFile )
405- return nil , errors .Errorf ("include cycle detected:\n %s\n include %s" , loaded [0 ], strings .Join (loaded [1 :], "\n include " ))
405+ return nil , fmt .Errorf ("include cycle detected:\n %s\n include %s" , loaded [0 ], strings .Join (loaded [1 :], "\n include " ))
406406 }
407407 }
408408 loaded = append (loaded , mainFile )
@@ -692,7 +692,7 @@ func formatInvalidKeyError(keyPrefix string, key interface{}) error {
692692 } else {
693693 location = fmt .Sprintf ("in %s" , keyPrefix )
694694 }
695- return errors .Errorf ("Non-string key %s: %#v" , location , key )
695+ return fmt .Errorf ("Non-string key %s: %#v" , location , key )
696696}
697697
698698// Windows path, c:\\my\\path\\shiny, need to be changed to be compatible with
0 commit comments