Skip to content

contracts: fix gosimple S1016 in payments rawResults loop#20

Closed
parkan wants to merge 1 commit into
masterfrom
fix/payments-gosimple-conversion
Closed

contracts: fix gosimple S1016 in payments rawResults loop#20
parkan wants to merge 1 commit into
masterfrom
fix/payments-gosimple-conversion

Conversation

@parkan
Copy link
Copy Markdown
Collaborator

@parkan parkan commented May 3, 2026

Pre-existing issue caught by golangci-lint v1.64.8 in CI:

contracts/payments.go:442:16: S1016: should convert r (type getRailsForPayerAndTokenItem)
to RailInfoResult instead of using struct literal (gosimple)

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. 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).

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.
@parkan parkan closed this May 3, 2026
@parkan parkan deleted the fix/payments-gosimple-conversion branch May 3, 2026 11:58
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.

1 participant