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

refactor: move from io/ioutil to io and os package #10341

Merged
merged 1 commit into from
Oct 13, 2021
Merged

refactor: move from io/ioutil to io and os package #10341

merged 1 commit into from
Oct 13, 2021

Conversation

Juneezee
Copy link
Contributor

Description

The io/ioutil package has been deprecated in Go 1.16 (See https://golang.org/doc/go1.16#ioutil). Since cosmos-sdk has upgraded to Go 1.17 (#9987), this PR replaces the existing io/ioutil functions with their new definitions in io and os packages.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@github-actions github-actions bot added C:CLI C:depinject Issues and PR related to depinject C:Cosmovisor Issues and PR related to Cosmovisor C:Keys Keybase, KMS and HSMs C:Simulations C:x/auth C:x/distribution distribution module related C:x/genutil genutil module issues C:x/gov C:x/params C:x/upgrade labels Oct 12, 2021
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!!

@tac0turtle tac0turtle added the A:automerge Automatically merge PR once all prerequisites pass. label Oct 12, 2021
@Juneezee
Copy link
Contributor Author

@marbar3778 Thanks! The failing tests seem flaky

  1. tests (01)
--- FAIL: TestIntegrationTestSuite (15.30s)
    network_test.go:21: setting up integration test suite
    network.go:202: acquiring test network lock
    network.go:212: preparing test network with chain-id "chain-Y760SM"
    network.go:476: starting test network...
    network_test.go:25: 
        	Error Trace:	network_test.go:25
        	            				suite.go:118
        	            				network_test.go:42
        	Error:      	Received unexpected error:
        	            	listen tcp 0.0.0.0:39611: bind: address already in use
        	Test:       	TestIntegrationTestSuite
  1. liveness-test: It seems to be using a Go version older than 1.16.
snapshots/manager.go:146:9: undefined: io.ReadAll
snapshots/manager.go:241:17: undefined: io.NopCloser
note: module requires Go 1.17
# github.com/cosmos/cosmos-sdk/crypto/keyring
crypto/keyring/keyring.go:684:19: undefined: os.ReadFile
crypto/keyring/keyring.go:748:14: undefined: os.WriteFile
note: module requires Go 1.17
# github.com/cosmos/cosmos-sdk/server/grpc/gogoreflection
server/grpc/gogoreflection/serverreflection.go:221:14: undefined: io.ReadAll
note: module requires Go 1.17
# github.com/cosmos/cosmos-sdk/codec/unknownproto
codec/unknownproto/unknown_fields.go:361:20: undefined: io.ReadAll
note: module requires Go 1.17
make: *** [Makefile:115: build] Error 2
make: *** [Makefile:133: build-simd-linux] Error 2
Error: Process completed with exit code 2.

@tac0turtle
Copy link
Member

liveness-test: It seems to be using a Go version older than 1.16.

https://github.com/cosmos/cosmos-sdk/blob/master/.github/workflows/test.yml#L227 seems like its setting 1.17, not sure where else the issue could be.

    	listen tcp 0.0.0.0:39611: bind: address already in use

maybe this was a fluke?

@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #10341 (db10308) into master (3637270) will decrease coverage by 0.02%.
The diff coverage is 62.50%.

❗ Current head db10308 differs from pull request most recent head 2e243be. Consider uploading reports for the commit 2e243be to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10341      +/-   ##
==========================================
- Coverage   64.26%   64.23%   -0.03%     
==========================================
  Files         572      572              
  Lines       54142    54150       +8     
==========================================
- Hits        34795    34785      -10     
- Misses      17366    17385      +19     
+ Partials     1981     1980       -1     
Impacted Files Coverage Δ
crypto/keyring/keyring.go 61.98% <0.00%> (ø)
simapp/state.go 0.00% <0.00%> (ø)
simapp/utils.go 21.62% <0.00%> (ø)
testutil/rest.go 0.00% <0.00%> (ø)
x/auth/client/cli/tx_multisign.go 0.00% <0.00%> (ø)
x/genutil/client/cli/gentx.go 0.00% <0.00%> (ø)
x/params/client/utils/utils.go 47.61% <0.00%> (ø)
x/simulation/event_stats.go 0.00% <0.00%> (ø)
x/auth/client/tx.go 36.26% <50.00%> (ø)
client/config/toml.go 55.55% <100.00%> (ø)
... and 13 more

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <[email protected]>
@mergify mergify bot merged commit 40a92a2 into cosmos:master Oct 13, 2021
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
## Description

The `io/ioutil` package has been deprecated in Go 1.16 (See https://golang.org/doc/go1.16#ioutil). Since cosmos-sdk has upgraded to Go 1.17 (cosmos#9987), this PR replaces the existing `io/ioutil` functions with their new definitions in `io` and `os` packages.

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:CLI C:Cosmovisor Issues and PR related to Cosmovisor C:depinject Issues and PR related to depinject C:Keys Keybase, KMS and HSMs C:Simulations C:x/auth C:x/distribution distribution module related C:x/genutil genutil module issues C:x/gov C:x/params C:x/upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants