Skip to content

Conversation

debarshiray
Copy link
Member

The os.IsNotExist() function [1] predates the introduction of the
errors.Is() function [2] in Go 1.13 [3]. From Go >= 1.16, the
documentation explicitly recommends the use of errors.Is() instead of
os.IsNotExist() [4].

The Go implementation of Toolbx never used any Go older than 1.13 [5],
and currently it requires Go >= 1.21 [6]. So, there's no reason not to
use the more modern and recommended alternative.

[1] https://pkg.go.dev/os#IsNotExist

[2] https://pkg.go.dev/errors#Is

[3] https://go.dev/blog/go1.13-errors

[4] Go commit b641f0dcf48aa748
golang/go@b641f0dcf48aa748
golang/go#41122

[5] Commit d857471
d857471aa2f233e5
#318

[6] Commit 82e85ba
82e85bac9f5e69a5
#1614

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Apr 25, 2025
The os.IsNotExist() function [1] predates the introduction of the
errors.Is() function [2] in Go 1.13 [3].  From Go >= 1.16, the
documentation explicitly recommends the use of errors.Is() instead of
os.IsNotExist() [4].

The Go implementation of Toolbx never used any Go older than 1.13 [5],
and currently it requires Go >= 1.21 [6].  So, there's no reason not to
use the more modern and recommended alternative.

[1] https://pkg.go.dev/os#IsNotExist

[2] https://pkg.go.dev/errors#Is

[3] https://go.dev/blog/go1.13-errors

[4] Go commit b641f0dcf48aa748
    golang/go@b641f0dcf48aa748
    golang/go#41122

[5] Commit d857471
    containers@d857471aa2f233e5
    containers#318

[6] Commit 82e85ba
    containers@82e85bac9f5e69a5
    containers#1614

containers#1629
@debarshiray debarshiray force-pushed the wip/rishi/pkg-utils-use-errors-Is-not-os-IsNotExist branch from 4d50cc3 to e17b729 Compare April 25, 2025 22:58
@debarshiray
Copy link
Member Author

recheck

Copy link

@debarshiray debarshiray force-pushed the wip/rishi/pkg-utils-use-errors-Is-not-os-IsNotExist branch from e17b729 to e9e77fb Compare April 28, 2025 11:30
The os.IsNotExist() function [1] predates the introduction of the
errors.Is() function [2] in Go 1.13 [3].  From Go >= 1.16, the
documentation explicitly recommends the use of errors.Is() instead of
os.IsNotExist() [4].

The Go implementation of Toolbx never used any Go older than 1.13 [5],
and currently it requires Go >= 1.21 [6].  So, there's no reason not to
use the more modern and recommended alternative.

[1] https://pkg.go.dev/os#IsNotExist

[2] https://pkg.go.dev/errors#Is

[3] https://go.dev/blog/go1.13-errors

[4] Go commit b641f0dcf48aa748
    golang/go@b641f0dcf48aa748
    golang/go#41122

[5] Commit d857471
    containers@d857471aa2f233e5
    containers#318

[6] Commit 82e85ba
    containers@82e85bac9f5e69a5
    containers#1614

containers#1629
Copy link

@debarshiray debarshiray changed the title pkg/utils: Use errors.Is() instead of os.IsNotExist() cmd/root, pkg/utils: Use errors.Is() instead of os.IsNotExist() Apr 28, 2025
Copy link

@debarshiray debarshiray merged commit 9989ffa into containers:main Apr 28, 2025
3 checks passed
@debarshiray debarshiray deleted the wip/rishi/pkg-utils-use-errors-Is-not-os-IsNotExist branch April 28, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant