mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Update usage of os.IsNotExist (#29)
Per [godoc](https://pkg.go.dev/os#IsNotExist), this is the preferred method.
This commit is contained in:
parent
d56042de6a
commit
ab3047bb39
2 changed files with 3 additions and 3 deletions
|
|
@ -54,9 +54,9 @@ func (s *fileStore) GetMeta() (map[string]json.RawMessage, error) {
|
|||
|
||||
func (s *fileStore) readData() error {
|
||||
stat, err := os.Stat(s.filename)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return errors.Wrap(err, "stat file store")
|
||||
} else if os.IsNotExist(err) {
|
||||
} else if errors.Is(err, os.ErrNotExist) {
|
||||
// initialize empty
|
||||
s.metadata = metadataMap{}
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ func (u *Updater) Download(repoPath, localPath string) error {
|
|||
|
||||
if constant.PlatformName == "windows" {
|
||||
// Remove old file first
|
||||
if err := os.Rename(localPath, localPath+".old"); err != nil && !os.IsNotExist(err) {
|
||||
if err := os.Rename(localPath, localPath+".old"); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
return errors.Wrap(err, "rename old")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue