From 96a6cef0d6a697172b707d8aae85c0fcbdd69566 Mon Sep 17 00:00:00 2001 From: Gleb Kanterov Date: Tue, 8 Oct 2024 10:28:51 +0200 Subject: [PATCH] Address feedbacK --- bundle/config/mutator/python/python_mutator.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bundle/config/mutator/python/python_mutator.go b/bundle/config/mutator/python/python_mutator.go index e259f372..7ee35da2 100644 --- a/bundle/config/mutator/python/python_mutator.go +++ b/bundle/config/mutator/python/python_mutator.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "io/fs" "os" "path/filepath" @@ -292,12 +293,10 @@ func writeInputFile(inputPath string, input dyn.Value) error { // loadLocationsFile loads locations.json containing source locations for generated YAML. func loadLocationsFile(locationsPath string) (*pythonLocations, error) { - if _, err := os.Stat(locationsPath); os.IsNotExist(err) { - return newPythonLocations(), nil - } - locationsFile, err := os.Open(locationsPath) - if err != nil { + if errors.Is(err, fs.ErrNotExist) { + return newPythonLocations(), nil + } else if err != nil { return nil, fmt.Errorf("failed to open locations file: %w", err) }