Skip to content

Commit 23f1ed1

Browse files
ecPabloCopilot
andauthored
chore(cldf): bump golang version (#677)
Chainlink core is already on this version https://github.com/smartcontractkit/chainlink/blob/develop/go.mod This pull request updates the development environment to use newer versions of Go and golangci-lint across the project. These changes ensure compatibility with the latest features, improvements, and security updates for both tools. **Development environment updates:** * Upgraded Go version from `1.24.5` to `1.25.5` in `.tool-versions` and `go.mod` to leverage the latest language features and improvements. [[1]](diffhunk://#diff-751af1a340658c7b8176fe32d7db9fadbe15d1d075daba1919a91df04155bc70L1-R2) [[2]](diffhunk://#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L3-R3) * Updated `golangci-lint` version from `2.5.0` to `2.8.0` in `.tool-versions` and in the GitHub Actions workflows (`pull-request-main.yml` and `schedule-main.yml`) to use the latest linter checks and bug fixes. [[1]](diffhunk://#diff-751af1a340658c7b8176fe32d7db9fadbe15d1d075daba1919a91df04155bc70L1-R2) [[2]](diffhunk://#diff-deba6b8d69fe72e6186b64f7934e93aa1d8213648ef0e99400caa36df42883f0L22-R22) [[3]](diffhunk://#diff-00a5b2e5be70dc0f682c3126e90a59bb428b0cbceafea6e65cf428baaeeb231fL22-R22) --------- Co-authored-by: Copilot <[email protected]>
1 parent 2f6f512 commit 23f1ed1

File tree

9 files changed

+29
-25
lines changed

9 files changed

+29
-25
lines changed

.github/workflows/pull-request-main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: smartcontractkit/.github/actions/ci-lint-go@ci-lint-go/v2 # [email protected]
2020
with:
2121
only-new-issues: "false"
22-
golangci-lint-version: v2.5.0
22+
golangci-lint-version: v2.8.0
2323

2424
ci-lint-misc:
2525
name: Lint GH Actions and scripts
@@ -101,18 +101,18 @@ jobs:
101101
--query 'reverse(sort_by(imageDetails,& imagePushedAt))' \
102102
--output json | \
103103
jq -r '
104-
[.[] |
105-
select(.imageTags != null) |
106-
.imageTags[] |
104+
[.[] |
105+
select(.imageTags != null) |
106+
.imageTags[] |
107107
select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))
108108
] | first
109109
')
110-
110+
111111
if [[ -z "${LATEST_TAG}" ]] || [[ "${LATEST_TAG}" == "null" ]]; then
112112
echo "::error::Could not find a valid semantic version tag in ECR"
113113
exit 1
114114
fi
115-
115+
116116
echo "Latest catalog service tag from ECR: ${LATEST_TAG}"
117117
echo "tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
118118

.github/workflows/schedule-main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: smartcontractkit/.github/actions/ci-lint-go@ci-lint-go/v2 # [email protected]
2020
with:
2121
only-new-issues: "false"
22-
golangci-lint-version: v2.5.0
22+
golangci-lint-version: v2.8.0
2323

2424
ci-lint-misc:
2525
name: Lint GH Actions and scripts
@@ -97,18 +97,18 @@ jobs:
9797
--query 'reverse(sort_by(imageDetails,& imagePushedAt))' \
9898
--output json | \
9999
jq -r '
100-
[.[] |
101-
select(.imageTags != null) |
102-
.imageTags[] |
100+
[.[] |
101+
select(.imageTags != null) |
102+
.imageTags[] |
103103
select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))
104104
] | first
105105
')
106-
106+
107107
if [[ -z "${LATEST_TAG}" ]] || [[ "${LATEST_TAG}" == "null" ]]; then
108108
echo "::error::Could not find a valid semantic version tag in ECR"
109109
exit 1
110110
fi
111-
111+
112112
echo "Latest catalog service tag from ECR: ${LATEST_TAG}"
113113
echo "tag=${LATEST_TAG}" >> "${GITHUB_OUTPUT}"
114114

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
golang 1.24.5
2-
golangci-lint 2.5.0
1+
golang 1.25.5
2+
golangci-lint 2.8.0
33
mockery 3.3.4
44
nodejs 20.16.0
55
pnpm 10.6.5

chain/evm/provider/zksync_ctf_provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (p *ZkSyncCTFChainProvider) getTransactors(
244244
require.FailNowf(p.t, "failed to parse chain ID into big.Int: %s", chainID)
245245
}
246246

247-
transactors := make([]*bind.TransactOpts, 0)
247+
transactors := make([]*bind.TransactOpts, 0, len(blockchain.AnvilZKSyncRichAccountPks))
248248
for _, pk := range blockchain.AnvilZKSyncRichAccountPks {
249249
privateKey, err := crypto.HexToECDSA(pk)
250250
require.NoError(p.t, err)

datastore/memory_address_ref_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (s *MemoryAddressRefStore) Fetch() ([]AddressRef, error) {
5252
s.mu.RLock()
5353
defer s.mu.RUnlock()
5454

55-
records := []AddressRef{}
55+
records := make([]AddressRef, 0, len(s.Records))
5656
for _, record := range s.Records {
5757
records = append(records, record.Clone())
5858
}

engine/cld/legacy/cli/commands/jd_helper.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func listProposalsByNodeId(
7070

7171
// toNodeIDs maps nodes into slice of IDs.
7272
func toNodeIDs(nodes []*nodev1.Node) []string {
73-
nodeIDs := make([]string, 0)
73+
nodeIDs := make([]string, 0, len(nodes))
7474
for _, ni := range nodes {
7575
nodeIDs = append(nodeIDs, ni.Id)
7676
}
@@ -80,7 +80,7 @@ func toNodeIDs(nodes []*nodev1.Node) []string {
8080

8181
// toJobIDs maps job slice into slice of IDs.
8282
func toJobIDs(jobs []*jobv1.Job) []string {
83-
ids := make([]string, 0)
83+
ids := make([]string, 0, len(jobs))
8484
for _, j := range jobs {
8585
ids = append(ids, j.Id)
8686
}
@@ -94,7 +94,7 @@ func toNodeViews(
9494
nidToProposals map[string][]*jobv1.Proposal,
9595
nidToJobs map[string][]*jobv1.Job,
9696
) []NodeView {
97-
nvs := make([]NodeView, 0)
97+
nvs := make([]NodeView, 0, len(ns))
9898
for _, n := range ns {
9999
jobsView := toJobsView(n, nidToProposals, nidToJobs)
100100
nvs = append(nvs, NodeView{
@@ -153,7 +153,7 @@ func writeNodeTable(nodes []*nodev1.Node) {
153153
for _, node := range nodes {
154154
labelsString := &strings.Builder{}
155155
labelsTable := tablewriter.NewWriter(labelsString)
156-
var labels [][]string
156+
labels := make([][]string, 0, len(node.Labels))
157157
for _, label := range node.Labels {
158158
labels = append(labels, []string{label.Key, *label.Value})
159159
}
@@ -178,7 +178,9 @@ func writeNodeTable(nodes []*nodev1.Node) {
178178
if len(node.P2PKeyBundles) > 0 {
179179
p2pBuilder := &strings.Builder{}
180180
p2pTable := tablewriter.NewWriter(p2pBuilder)
181-
var p2pData [][]string
181+
// Pre-allocate capacity for 2 rows per P2PKeyBundle (Peer ID and Public Key).
182+
// If the number of rows per bundle changes, update this multiplier accordingly.
183+
p2pData := make([][]string, 0, len(node.P2PKeyBundles)*2)
182184
for _, p2p := range node.P2PKeyBundles {
183185
p2pData = append(p2pData, []string{"Peer ID", p2p.PeerId})
184186
p2pData = append(p2pData, []string{"Public Key", p2p.PublicKey})

engine/cld/legacy/cli/commands/template_input.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ changesets:
3131
`, envKey, domainName)
3232

3333
// Generate each changeset section
34+
var yamlTemplateSb34 strings.Builder
3435
for i, changesetName := range changesetNames {
3536
if changesetName == "" {
3637
continue
3738
}
3839

3940
// Add separator between changesets
4041
if i > 0 {
41-
yamlTemplate += "\n # ----------------------------------------\n"
42+
yamlTemplateSb34.WriteString("\n # ----------------------------------------\n")
4243
}
4344

4445
// Get changeset configuration
@@ -53,8 +54,9 @@ changesets:
5354
return "", fmt.Errorf("generate section for changeset %s: %w", changesetName, err)
5455
}
5556

56-
yamlTemplate += changesetSection
57+
yamlTemplateSb34.WriteString(changesetSection)
5758
}
59+
yamlTemplate += yamlTemplateSb34.String()
5860

5961
return yamlTemplate, nil
6062
}

engine/cld/legacy/cli/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (s normalizer) trim() normalizer {
3535
}
3636

3737
func (s normalizer) indent() normalizer {
38-
indentedLines := []string{}
38+
indentedLines := make([]string, 0, strings.Count(s.string, "\n")+1)
3939
for line := range strings.SplitSeq(s.string, "\n") {
4040
trimmed := strings.TrimSpace(line)
4141
indented := Indentation + trimmed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/smartcontractkit/chainlink-deployments-framework
22

3-
go 1.24.5
3+
go 1.25.5
44

55
replace github.com/fbsobreira/gotron-sdk => github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.4
66

0 commit comments

Comments
 (0)