From 8a2e6bc7d651c9c883e10ca2b173125f151b6fc0 Mon Sep 17 00:00:00 2001 From: Arkadiy Kukarkin Date: Sun, 3 May 2026 12:45:33 +0100 Subject: [PATCH] contracts: collapse rawResults loop to type conversion (gosimple S1016) 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. --- contracts/payments.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contracts/payments.go b/contracts/payments.go index 4b81337..3d3e34e 100644 --- a/contracts/payments.go +++ b/contracts/payments.go @@ -423,11 +423,10 @@ func (p *PaymentsContract) GetRailsForPayerAndToken(ctx context.Context, payer, results := make([]RailInfoResult, len(rawResults)) for i, r := range rawResults { - results[i] = RailInfoResult{ - RailId: r.RailId, - IsTerminated: r.IsTerminated, - EndEpoch: r.EndEpoch, - } + // abi.Unpack produces an anonymous struct whose fields and types + // match RailInfoResult exactly; struct tags don't affect Go's + // conversion identity. (gosimple S1016) + results[i] = RailInfoResult(r) } return results, values[1].(*big.Int), values[2].(*big.Int), nil