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: dir no longer panics when HOME and XDG_CONFIG_HOME are not set #449

Merged
merged 16 commits into from
Sep 4, 2024

Conversation

JasonTheDeveloper
Copy link
Contributor

This PR addresses the issue #446

In this PR I:

  • I removed the init() function from dir/path
  • When userConfigDir() returns an error, instead of panic(err) I default to the current directory instead
  • Split loadUserPath() into two new functions used to setup and return the values for UserConfigDir and UserLibexecDir
  • Added additional unit tests for the two new functions and to test the default directory is used when HOME is set to ""

dir/path.go Outdated Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
dir/path.go Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
dir/path.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.98%. Comparing base (115509e) to head (5f6bf77).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #449      +/-   ##
==========================================
+ Coverage   80.86%   80.98%   +0.11%     
==========================================
  Files          33       33              
  Lines        2483     2487       +4     
==========================================
+ Hits         2008     2014       +6     
+ Misses        332      331       -1     
+ Partials      143      142       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

JeyJeyGao
JeyJeyGao previously approved these changes Sep 3, 2024
Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

dir/path.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Two-Hearts Two-Hearts left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

@JeyJeyGao
Copy link
Contributor

@JasonTheDeveloper

The base branch requires all commits to be signed

You need to fix it.

@JasonTheDeveloper
Copy link
Contributor Author

JasonTheDeveloper commented Sep 3, 2024

@JasonTheDeveloper

The base branch requires all commits to be signed

You need to fix it.

@JeyJeyGao All my commits are signed though? DCO also passed the sign off checks. Not sure why GitHub is saying The base branch requires all commits to be signed.

image

Copy link
Contributor

@priteshbandi priteshbandi left a comment

Choose a reason for hiding this comment

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

LGTM

@JasonTheDeveloper JasonTheDeveloper force-pushed the fix/446-init-panic branch 3 times, most recently from 7e26ba3 to 05b532f Compare September 4, 2024 05:50
JasonTheDeveloper and others added 15 commits September 4, 2024 16:47
Co-authored-by: Shiwei Zhang <[email protected]>
Signed-off-by: JasonTheDeveloper <[email protected]>
Signed-off-by: Jason <[email protected]>
This PR targets on main branch.

---------

Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Jason <[email protected]>
@JeyJeyGao JeyJeyGao merged commit 4d76f9a into notaryproject:main Sep 4, 2024
9 checks passed
@JasonTheDeveloper JasonTheDeveloper deleted the fix/446-init-panic branch September 4, 2024 07:06
JeyJeyGao pushed a commit to JeyJeyGao/notation-go that referenced this pull request Sep 4, 2024
…otaryproject#449)

This PR addresses the issue notaryproject#446

In this PR I:

- I removed the `init()` function from `dir/path`
- When `userConfigDir()` returns an error, instead of `panic(err)` I
default to the current directory instead
- Split `loadUserPath()` into two new functions used to setup and return
the values for `UserConfigDir` and `UserLibexecDir`
- Added additional unit tests for the two new functions and to test the
default directory is used when `HOME` is set to `""`

---------

Signed-off-by: Jason <[email protected]>
Signed-off-by: JasonTheDeveloper <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Shiwei Zhang <[email protected]>
Co-authored-by: Patrick Zheng <[email protected]>
Two-Hearts added a commit to Two-Hearts/notation-go that referenced this pull request Sep 4, 2024
…otaryproject#449)

This PR addresses the issue notaryproject#446

In this PR I:

- I removed the `init()` function from `dir/path`
- When `userConfigDir()` returns an error, instead of `panic(err)` I
default to the current directory instead
- Split `loadUserPath()` into two new functions used to setup and return
the values for `UserConfigDir` and `UserLibexecDir`
- Added additional unit tests for the two new functions and to test the
default directory is used when `HOME` is set to `""`

---------

Signed-off-by: Jason <[email protected]>
Signed-off-by: JasonTheDeveloper <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Shiwei Zhang <[email protected]>
Co-authored-by: Patrick Zheng <[email protected]>
JeyJeyGao pushed a commit to JeyJeyGao/notation-go that referenced this pull request Sep 4, 2024
…otaryproject#449)

This PR addresses the issue notaryproject#446

In this PR I:

- I removed the `init()` function from `dir/path`
- When `userConfigDir()` returns an error, instead of `panic(err)` I
default to the current directory instead
- Split `loadUserPath()` into two new functions used to setup and return
the values for `UserConfigDir` and `UserLibexecDir`
- Added additional unit tests for the two new functions and to test the
default directory is used when `HOME` is set to `""`

---------

Signed-off-by: Jason <[email protected]>
Signed-off-by: JasonTheDeveloper <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: Shiwei Zhang <[email protected]>
Co-authored-by: Patrick Zheng <[email protected]>
JeyJeyGao added a commit that referenced this pull request Sep 5, 2024
…449)  (#450)

This PR addresses the issue
#446 for
`release-1.1` branch
This commit was cherry picked from commit
4d76f9a


In this PR I:

- I removed the `init()` function from `dir/path`
- When `userConfigDir()` returns an error, instead of `panic(err)` I
default to the current directory instead
- Split `loadUserPath()` into two new functions used to setup and return
the values for `UserConfigDir` and `UserLibexecDir`
- Added additional unit tests for the two new functions and to test the
default directory is used when `HOME` is set to `""`

Signed-off-by: Jason <[email protected]>
Signed-off-by: JasonTheDeveloper <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Co-authored-by: JasonTheDeveloper <[email protected]>
Co-authored-by: Shiwei Zhang <[email protected]>
Co-authored-by: Patrick Zheng <[email protected]>
@JeyJeyGao JeyJeyGao mentioned this pull request Sep 5, 2024
6 tasks
JeyJeyGao added a commit that referenced this pull request Sep 9, 2024
## Release

This would mean tagging 595c710
`v1.1.2` to release.

## Vote

We need at least `4` approvals from `6` maintainers to release
`notation-go v1.1.2`.

- [x] Pritesh Bandi (@priteshbandi)
- [x] Junjie Gao (@JeyJeyGao)
- [ ] Rakesh Gariganti (@rgnote)
- [ ] Milind Gokarn (@gokarnm)
- [x] Shiwei Zhang (@shizhMSFT)
- [x] Patrick Zheng (@Two-Hearts)


## What's Changed
* fix&bump: maintenance update for branch `release-1.1` by @JeyJeyGao in
#448
* fix: dir no longer panics when HOME and XDG_CONFIG_HOME are not set
(#449) by @JeyJeyGao in
#450


**Full Changelog**:
v1.1.1...595c710

## Actions

Please review the PR and vote by approving.

Signed-off-by: Junjie Gao <[email protected]>
@JeyJeyGao JeyJeyGao mentioned this pull request Sep 9, 2024
6 tasks
@Two-Hearts Two-Hearts mentioned this pull request Sep 27, 2024
6 tasks
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.

Bug: Notation panics on init when $HOME and $XDG_CONFIG_HOME unset
6 participants