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

build: bump go version #715

Merged
merged 7 commits into from
Mar 19, 2024
Merged

build: bump go version #715

merged 7 commits into from
Mar 19, 2024

Conversation

dextrot
Copy link
Contributor

@dextrot dextrot commented Feb 27, 2024

This PR fixes #713

  • bumps go version in README.md, go.mod and GitHub Actions.

Signed-off-by: dextrot <[email protected]>
Signed-off-by: dextrot <[email protected]>
@shizhMSFT shizhMSFT changed the title Bump go version build: bump go version Mar 6, 2024
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.62%. Comparing base (0285961) to head (30298d1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #715      +/-   ##
==========================================
- Coverage   75.92%   75.62%   -0.30%     
==========================================
  Files          59       64       +5     
  Lines        5873     5994     +121     
==========================================
+ Hits         4459     4533      +74     
- Misses       1037     1078      +41     
- Partials      377      383       +6     

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

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.

@dextrot The build failed because go 1.22 changed the implementation of io.NopCloser.

To fix it, you need to update the code

// nopCloserType is the type of `io.NopCloser()`.
var nopCloserType = reflect.TypeOf(io.NopCloser(nil))
// UnwrapNopCloser unwraps the reader wrapped by `io.NopCloser()`.
// Similar implementation can be found in the built-in package `net/http`.
// Reference: https://github.com/golang/go/blob/go1.17.6/src/net/http/transfer.go#L423-L425
func UnwrapNopCloser(rc io.Reader) io.Reader {
if reflect.TypeOf(rc) == nopCloserType {
return reflect.ValueOf(rc).Field(0).Interface().(io.Reader)
}
return rc
}

to be updated with https://github.com/golang/go/blob/go1.22.1/src/net/http/transfer.go#L1090-L1105

More unit test cases should also be added to TestUnwrapNopCloser.

internal/ioutil/io.go Outdated Show resolved Hide resolved
internal/ioutil/io.go Show resolved Hide resolved
@shizhMSFT
Copy link
Contributor

@dextrot Since we need this PR in the incoming v2.5.0 version, would you like to address the comments?

internal/ioutil/io.go Outdated Show resolved Hide resolved
internal/ioutil/io.go Outdated Show resolved Hide resolved
internal/ioutil/io.go Outdated Show resolved Hide resolved
@dextrot
Copy link
Contributor Author

dextrot commented Mar 18, 2024

@dextrot Since we need this PR in the incoming v2.5.0 version, would you like to address the comments?

Done.
Please take a look, if I need to make any further changes.

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. Thanks for contribution!

@shizhMSFT shizhMSFT merged commit bf0d637 into oras-project:main Mar 19, 2024
9 checks passed
Wwwsylvia pushed a commit that referenced this pull request Mar 19, 2024
Add a new unit test case by the change to `UnwrapNopCloser` introduced
by #715

---------

Signed-off-by: Shiwei Zhang <[email protected]>
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.

Shift Go Support Window to [1.21, 1.22]
2 participants