Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add not exist check for loadConfigFile error #1325

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

mmsqe
Copy link
Contributor

@mmsqe mmsqe commented Nov 9, 2023

No description provided.

CHANGELOG.md Outdated Show resolved Hide resolved
@mmsqe mmsqe marked this pull request as ready for review November 9, 2023 03:27
cmd/appstate.go Outdated
@@ -40,7 +40,10 @@ func (a *appState) loadConfigFile(ctx context.Context) error {

if _, err := os.Stat(cfgPath); err != nil {
// don't return error if file doesn't exist
return nil
if os.IsExist(err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit but the Go docs for IsExists states, "This function predates errors.Is. It only supports errors returned by the os package. New code should use errors.Is(err, fs.ErrExist)."

Could we possibly swap the IsExists call out for errors.Is?

@mmsqe mmsqe changed the title fix: add os.IsExist check for loadConfigFile error fix: add not exist check for loadConfigFile error Nov 10, 2023
Copy link
Member

@jtieri jtieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grazie!

@jtieri jtieri merged commit 9b80dd0 into cosmos:main Nov 10, 2023
18 checks passed
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.

2 participants