contracts: fix gosimple S1016 in payments rawResults loop#20
Closed
parkan wants to merge 1 commit into
Closed
Conversation
abi.Unpack returns the rawResults entries as an anonymous struct whose fields and types match RailInfoResult exactly; struct tags don't affect Go's struct conversion identity, so a per-field literal isn't needed. CI started failing on this with golangci-lint v1.64.8: contracts/payments.go:442:16: S1016: should convert r (type getRailsForPayerAndTokenItem) to RailInfoResult instead of using struct literal (gosimple) Also explains why in a one-line comment so the conversion isn't mistaken for unsafe punning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-existing issue caught by golangci-lint v1.64.8 in CI:
abi.Unpackreturns the rawResults entries as an anonymous struct whose fields and types matchRailInfoResultexactly; struct tags don't affect Go's struct conversion identity, so a per-field literal isn't needed. Collapse the loop body to a single type conversion + a one-line comment explaining the conversion isn't unsafe punning.Verified locally with golangci-lint v1.64.8 (the version CI installs).