Skip to content

Commit ffaed1e

Browse files
authored
Update for Go 1.24 and dependency upgrades (#713)
* Update for Go 1.24 and dependency upgrades * Update for Go 1.24 and dependency upgrades * Update for Go 1.24 and dependency upgrades * Migrate to the new linter v2 * fix go.sum * fix async test
1 parent d48ce0a commit ffaed1e

38 files changed

+222
-189
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ orbs:
44
executors:
55
golang-executor:
66
docker:
7-
- image: gcr.io/gcr-for-testing/golang:1.23.12
7+
- image: gcr.io/gcr-for-testing/golang:1.24.9
88
machine-executor:
99
machine:
1010
image: ubuntu-2204:current
@@ -19,7 +19,7 @@ aliases:
1919
parameters:
2020
goImage:
2121
type: string
22-
default: "gcr.io/gcr-for-testing/golang:1.23.12"
22+
default: "gcr.io/gcr-for-testing/golang:1.24.9"
2323
arangodbImage:
2424
type: string
2525
default: "gcr.io/gcr-for-testing/arangodb/enterprise-preview:latest"

.golangci.yaml

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,77 @@
1-
---
2-
1+
version: 2
32
run:
43
issues-exit-code: 3
5-
timeout: 30m
6-
skip-dirs:
7-
- vendor
8-
94
linters:
10-
fast: false
11-
enable-all: false
12-
disable-all: false
13-
presets:
14-
- performance
15-
- format
16-
- complexity
17-
- bugs
18-
- unused
5+
enable:
6+
- asasalint
7+
- asciicheck
8+
- bidichk
9+
- bodyclose
10+
- durationcheck
11+
- fatcontext
12+
- gocheckcompilerdirectives
13+
- gochecksumtype
14+
- gosmopolitan
15+
- loggercheck
16+
- makezero
17+
- nilerr
18+
- nilnesserr
19+
- perfsprint
20+
- protogetter
21+
- reassign
22+
- recvcheck
23+
- rowserrcheck
24+
- spancheck
25+
- sqlclosecheck
26+
# - testifylint
27+
# - zerologlint
1928
disable:
20-
- staticcheck
21-
- errcheck
22-
- govet
23-
- gosec
24-
- ineffassign
25-
- noctx
2629
- contextcheck
27-
- unparam
28-
- scopelint
29-
- exhaustive
3030
- cyclop
31-
- errorlint
31+
- errcheck
3232
- errchkjson
33-
- nestif
34-
- prealloc
35-
- maligned
33+
- errorlint
34+
- exhaustive
3635
- funlen
37-
- typecheck
38-
- deadcode
39-
- unused
40-
- maintidx
41-
- varcheck
4236
- gocognit
43-
- gofumpt
4437
- gocyclo
45-
- musttag # seems to be broken
46-
linters-settings:
47-
gci:
48-
sections:
49-
- standard
50-
- default
51-
- prefix(github.com/arangodb)
52-
- prefix(github.com/arangodb/go-driver)
38+
- gosec
39+
- govet
40+
- ineffassign
41+
- maintidx
42+
- musttag
43+
- nestif
44+
- noctx
45+
- prealloc
46+
- staticcheck
47+
- unparam
48+
- unused
49+
exclusions:
50+
generated: lax
51+
presets:
52+
- comments
53+
- common-false-positives
54+
- legacy
55+
- std-error-handling
56+
paths:
57+
- third_party$
58+
- builtin$
59+
- examples$
60+
formatters:
61+
enable:
62+
- gci
63+
- gofmt
64+
- goimports
65+
settings:
66+
gci:
67+
sections:
68+
- standard
69+
- default
70+
- prefix(github.com/arangodb)
71+
- prefix(github.com/arangodb/go-driver)
72+
exclusions:
73+
generated: lax
74+
paths:
75+
- third_party$
76+
- builtin$
77+
- examples$

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/go-driver/tree/master) (N/A)
4+
- Switch to Go 1.24.9
45

56
## [1.6.7](https://github.com/arangodb/go-driver/tree/v1.6.7) (2025-08-31)
67
- Switch to Go 1.22.12

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SCRIPTDIR := $(shell pwd)
44
CURR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
55
ROOTDIR:=$(CURR)
66

7-
GOVERSION ?= 1.23.12
7+
GOVERSION ?= 1.24.9
88
GOTOOLCHAIN ?= auto
99
GOIMAGE ?= golang:$(GOVERSION)
1010
GOV2IMAGE ?= $(GOIMAGE)
@@ -559,9 +559,9 @@ endif
559559
.PHONY: tools
560560
tools: __dir_setup
561561
@echo ">> Fetching golangci-lint linter"
562-
@GOBIN=$(TMPDIR)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
562+
@GOBIN=$(TMPDIR)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.1
563563
@echo ">> Fetching goimports"
564-
@GOBIN=$(TMPDIR)/bin go install golang.org/x/tools/cmd/goimports@v0.32.0
564+
@GOBIN=$(TMPDIR)/bin go install golang.org/x/tools/cmd/goimports@v0.38.0
565565
@echo ">> Fetching license check"
566566
@GOBIN=$(TMPDIR)/bin go install github.com/google/addlicense@v1.0.0
567567
@echo ">> Fetching govulncheck"
@@ -591,6 +591,7 @@ fmt-verify: license-verify
591591

592592
.PHONY: linter
593593
linter: fmt-verify
594+
@echo ">> Running linter"
594595
@$(TMPDIR)/bin/golangci-lint run ./...
595596

596597
.PHONY: vulncheck

agency/agency_connection.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2018-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -17,13 +17,12 @@
1717
//
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
20-
// Author Ewout Prangsma
21-
//
2220

2321
package agency
2422

2523
import (
2624
"context"
25+
"errors"
2726
"fmt"
2827
"sync"
2928
"time"
@@ -69,7 +68,7 @@ func (c *agencyConnection) NewRequest(method, path string) (driver.Request, erro
6968
defer c.mutex.RUnlock()
7069

7170
if len(c.connections) == 0 {
72-
return nil, driver.WithStack(fmt.Errorf("no connections"))
71+
return nil, driver.WithStack(errors.New("no connections"))
7372
}
7473
r, err := c.connections[0].NewRequest(method, path)
7574
if err != nil {
@@ -132,7 +131,7 @@ func (c *agencyConnection) doOnce(ctx context.Context, req driver.Request) (driv
132131
c.mutex.RUnlock()
133132

134133
if len(c.connections) == 0 {
135-
return nil, true, driver.WithStack(fmt.Errorf("no connections"))
134+
return nil, true, driver.WithStack(errors.New("no connections"))
136135
}
137136

138137
parallelRequests := true
@@ -208,7 +207,7 @@ func (c *agencyConnection) doOnce(ctx context.Context, req driver.Request) (driv
208207

209208
func isSuccess(resp driver.Response) error {
210209
if resp == nil {
211-
return driver.WithStack(fmt.Errorf("Response is nil"))
210+
return driver.WithStack(errors.New("Response is nil"))
212211
}
213212
statusCode := resp.StatusCode()
214213
if statusCode >= 200 && statusCode < 300 {
@@ -235,7 +234,7 @@ func (c *agencyConnection) Unmarshal(data driver.RawObject, result interface{})
235234
defer c.mutex.RUnlock()
236235

237236
if len(c.connections) == 0 {
238-
return driver.WithStack(fmt.Errorf("no connections"))
237+
return driver.WithStack(errors.New("no connections"))
239238
}
240239
if err := c.connections[0].Unmarshal(data, result); err != nil {
241240
return driver.WithStack(err)

agency/agency_health.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2018-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -17,13 +17,12 @@
1717
//
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
20-
// Author Ewout Prangsma
21-
//
2220

2321
package agency
2422

2523
import (
2624
"context"
25+
"errors"
2726
"fmt"
2827
"net/http"
2928
"net/url"
@@ -134,7 +133,7 @@ func AreAgentsHealthy(ctx context.Context, clients []driver.Connection) error {
134133
// Compare leader endpoint with previous
135134
prev := statuses[i-1].LeaderEndpoint
136135
if !IsSameEndpoint(prev, status.LeaderEndpoint) {
137-
return driver.WithStack(fmt.Errorf("Not all agents report the same leader endpoint"))
136+
return driver.WithStack(errors.New("Not all agents report the same leader endpoint"))
138137
}
139138
}
140139
}

agency/agency_impl.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package agency
2323
import (
2424
"context"
2525
"encoding/json"
26+
"errors"
2627
"fmt"
2728
"strings"
2829
"time"
@@ -155,7 +156,7 @@ func (c *agency) WriteKey(ctx context.Context, key []string, value interface{},
155156
case 1:
156157
cond = condition[0]
157158
default:
158-
return driver.WithStack(fmt.Errorf("too many conditions"))
159+
return driver.WithStack(errors.New("too many conditions"))
159160
}
160161

161162
transaction := NewTransaction("", TransactionOptions{})
@@ -296,7 +297,7 @@ func (c *agency) RemoveKey(ctx context.Context, key []string, condition ...Write
296297
case 1:
297298
cond = condition[0]
298299
default:
299-
return driver.WithStack(fmt.Errorf("too many conditions"))
300+
return driver.WithStack(errors.New("too many conditions"))
300301
}
301302

302303
transaction := NewTransaction("", TransactionOptions{})

agency/transaction.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2020-2023 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2020-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
2121
package agency
2222

2323
import (
24-
"fmt"
24+
"errors"
2525

2626
"github.com/arangodb/go-driver"
2727
)
@@ -43,7 +43,7 @@ type Transaction struct {
4343
// The argument 'clientID' should be used to mark that transaction sender uniquely.
4444
func NewTransaction(clientID string, options TransactionOptions) Transaction {
4545
if clientID == "" {
46-
clientID = fmt.Sprintf("go-driver/%s", driver.DriverVersion())
46+
clientID = "go-driver/" + driver.DriverVersion()
4747
}
4848

4949
return Transaction{
@@ -60,7 +60,7 @@ func (k *Transaction) AddConditionByFullKey(fullKey string, condition KeyConditi
6060

6161
if _, ok := k.conditions[fullKey]; ok {
6262
// For the time being one key can have only one condition. It is a limitation in agency
63-
return driver.WithStack(fmt.Errorf("too many conditions"))
63+
return driver.WithStack(errors.New("too many conditions"))
6464
}
6565

6666
k.conditions[fullKey] = condition

asyncjob_impl.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2023-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@ package driver
2222

2323
import (
2424
"context"
25-
"fmt"
2625
"path"
26+
"strconv"
2727
)
2828

2929
const asyncJobAPI = "_api/job"
@@ -45,7 +45,7 @@ func (c *clientAsyncJob) List(ctx context.Context, jobType AsyncJobStatusType, o
4545
}
4646

4747
if opts != nil && opts.Count != 0 {
48-
req.SetQuery("count", fmt.Sprintf("%d", opts.Count))
48+
req.SetQuery("count", strconv.Itoa(opts.Count))
4949
}
5050

5151
var rawResponse []byte
@@ -141,7 +141,7 @@ func (c *clientAsyncJob) Delete(ctx context.Context, deleteType AsyncJobDeleteTy
141141
}
142142

143143
if deleteType == DeleteExpiredJobs {
144-
req.SetQuery("stamp", fmt.Sprintf("%d", opts.Stamp.Unix()))
144+
req.SetQuery("stamp", strconv.FormatInt(opts.Stamp.Unix(), 10))
145145
}
146146

147147
resp, err := c.conn.Do(ctx, req)

client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (v *VersionInfo) IsEnterprise() bool {
140140
}
141141

142142
// String creates a string representation of the given VersionInfo.
143-
func (v VersionInfo) String() string {
143+
func (v *VersionInfo) String() string {
144144
result := fmt.Sprintf("%s, version %s, license %s", v.Server, v.Version, v.License)
145145
if len(v.Details) > 0 {
146146
lines := make([]string, 0, len(v.Details))

0 commit comments

Comments
 (0)