Address feedbacK

This commit is contained in:
Gleb Kanterov 2024-10-08 10:28:51 +02:00
parent bfb13afa8e
commit 96a6cef0d6
No known key found for this signature in database
GPG Key ID: 4D87C640DBD00176
1 changed files with 4 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"io/fs"
"os" "os"
"path/filepath" "path/filepath"
@ -292,12 +293,10 @@ func writeInputFile(inputPath string, input dyn.Value) error {
// loadLocationsFile loads locations.json containing source locations for generated YAML. // loadLocationsFile loads locations.json containing source locations for generated YAML.
func loadLocationsFile(locationsPath string) (*pythonLocations, error) { func loadLocationsFile(locationsPath string) (*pythonLocations, error) {
if _, err := os.Stat(locationsPath); os.IsNotExist(err) {
return newPythonLocations(), nil
}
locationsFile, err := os.Open(locationsPath) 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) return nil, fmt.Errorf("failed to open locations file: %w", err)
} }