Replace deprecated os.Is{Not,}Exist calls
This commit replaces deprecated calls to `os.Is{Not,}Exist` with the
newer `errors.Is(err, fs.Err{Not,}Exist)`.
This commit is contained in:
parent
473040a69f
commit
9807213e60
9 changed files with 22 additions and 11 deletions
|
|
@ -2,6 +2,8 @@ package cli
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
|
|
@ -19,9 +21,9 @@ type Params struct {
|
|||
// Uses [ReadBaseDirectory] or falls back to [BaseDirectoryDefault].
|
||||
func ParamsFromEnv() (params Params, err error) {
|
||||
// try to read the base directory!
|
||||
value, err := ReadBaseDirectory() // TODO: Are we sure about the native environment here?
|
||||
value, err := ReadBaseDirectory()
|
||||
switch {
|
||||
case os.IsNotExist(err):
|
||||
case errors.Is(err, fs.ErrNotExist):
|
||||
params.ConfigPath = bootstrap.BaseDirectoryDefault
|
||||
case err == nil:
|
||||
params.ConfigPath = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue