feat: do not distinguish errors for simple case
Failed to read file can result in error not existtmain
parent
a08fd5bf8e
commit
31308c6ead
|
@ -2,7 +2,6 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -39,10 +38,6 @@ func LoadConfig(path string) (*configReal, *configDemo, error) {
|
||||||
configPath := getConfigPath(path)
|
configPath := getConfigPath(path)
|
||||||
bytes, err := os.ReadFile(configPath)
|
bytes, err := os.ReadFile(configPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, os.ErrNotExist) {
|
|
||||||
return nil, nil, fmt.Errorf("file not exist %s: %w", configPath, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil, fmt.Errorf("failed to read file%s: %w", configPath, err)
|
return nil, nil, fmt.Errorf("failed to read file%s: %w", configPath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue