Skip to content

Commit 9fd9da4

Browse files
authored
chore(deps): Update dependency golangci/golangci-lint to v1.64.5 (#2087)
This PR contains the following updates: | Package | Update | Change | Pending | |---|---|---|---| | [golangci/golangci-lint](https://redirect.github.com/golangci/golangci-lint) | minor | `v1.63.4` -> `v1.64.5` | `v1.64.6` | --- ### Release Notes <details> <summary>golangci/golangci-lint (golangci/golangci-lint)</summary> ### [`v1.64.5`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1645) [Compare Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.64.4...v1.64.5) 1. Bug fixes - Add missing flag `new-from-merge-base-flag` 2. Linters bug fixes - `asciicheck`: from 0.3.0 to 0.4.0 - `forcetypeassert`: from 0.1.0 to 0.2.0 - `gosec`: from 2.22.0 to 2.22.1 ### [`v1.64.4`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1644) [Compare Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.64.3...v1.64.4) 1. Linters bug fixes - `gci`: fix standard packages list for go1.24 ### [`v1.64.3`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1643) [Compare Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.64.2...v1.64.3) 1. Linters bug fixes - `ginkgolinter`: from 0.18.4 to 0.19.0 - `go-critic`: from 0.11.5 to 0.12.0 - `revive`: from 1.6.0 to 1.6.1 - `gci`: fix standard packages list for go1.24 2. Misc. - Build Docker images with go1.24 ### [`v1.64.2`](https://redirect.github.com/golangci/golangci-lint/blob/HEAD/CHANGELOG.md#v1642) [Compare Source](https://redirect.github.com/golangci/golangci-lint/compare/v1.63.4...v1.64.2) This is the last minor release of golangci-lint v1. The next release will be golangci-lint [v2](https://redirect.github.com/golangci/golangci-lint/issues/5300). 1. Enhancements - 🎉 go1.24 support - New `issues.new-from-merge-base` option - New `run.relative-path-mode` option 2. Linters new features - `copyloopvar`: from 1.1.0 to 1.2.1 (support suggested fixes) - `exptostd`: from 0.3.1 to 0.4.1 (handles `golang.org/x/exp/constraints.Ordered`) - `fatcontext`: from 0.5.3 to 0.7.1 (new option: `check-struct-pointers`) - `perfsprint`: from 0.7.1 to 0.8.1 (new options: `integer-format`, `error-format`, `string-format`, `bool-format`, and `hex-format`) - `revive`: from 1.5.1 to 1.6.0 (new rules: `redundant-build-tag`, `use-errors-new`. New option `early-return.early-return`) 3. Linters bug fixes - `go-errorlint`: from 1.7.0 to 1.7.1 - `gochecknoglobals`: from 0.2.1 to 0.2.2 - `godox`: from [`006bad1`](https://redirect.github.com/golangci/golangci-lint/commit/006bad1f9d26) to 1.1.0 - `gosec`: from 2.21.4 to 2.22.0 - `iface`: from 1.3.0 to 1.3.1 - `nilnesserr`: from 0.1.1 to 0.1.2 - `protogetter`: from 0.3.8 to 0.3.9 - `sloglint`: from 0.7.2 to 0.9.0 - `spancheck`: fix default `StartSpanMatchersSlice` values - `staticcheck`: from 0.5.1 to 0.6.0 4. Deprecations - ⚠️ `tenv` is deprecated and replaced by `usetesting.os-setenv: true`. - ⚠️ `exportloopref` deprecation step 2 5. Misc. - Sanitize severities by output format - Avoid panic with plugin without description 6. Documentation - Clarify `depguard` configuration </details> --- ### Configuration 📅 **Schedule**: Branch creation - "* 0-3 1 * *" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODUuMCIsInVwZGF0ZWRJblZlciI6IjM5LjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
1 parent 4faff6a commit 9fd9da4

File tree

15 files changed

+110
-38
lines changed

15 files changed

+110
-38
lines changed

.github/workflows/lint_golang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- name: golangci-lint
2121
uses: golangci/golangci-lint-action@v6
2222
with:
23-
version: v1.63.4
23+
version: v1.64.5

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ linters:
8686
- unconvert
8787
- unparam
8888
- unused
89+
issues:
90+
max-issues-per-linter: 0
91+
max-same-issues: 0

configtype/time.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package configtype
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
67
"math"
78
"regexp"
@@ -212,13 +213,13 @@ func parseTimeDuration(s string) (timeDuration, error) {
212213
inValue = false
213214
case part == "ago":
214215
if d.sign != 0 {
215-
return timeDuration{}, fmt.Errorf("invalid duration format: more than one sign specifier")
216+
return timeDuration{}, errors.New("invalid duration format: more than one sign specifier")
216217
}
217218

218219
d.sign = -1
219220
case part == "from":
220221
if d.sign != 0 {
221-
return timeDuration{}, fmt.Errorf("invalid duration format: more than one sign specifier")
222+
return timeDuration{}, errors.New("invalid duration format: more than one sign specifier")
222223
}
223224

224225
inSign = true

faker/faker.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package faker
22

33
import (
44
"encoding/json"
5+
"errors"
56
"fmt"
67
"math/rand"
78
"reflect"
@@ -15,16 +16,16 @@ type faker struct {
1516
logger zerolog.Logger
1617
}
1718

18-
var errEFaceNotAllowed = fmt.Errorf("any not allowed")
19+
var errEFaceNotAllowed = errors.New("any not allowed")
1920

20-
func (f faker) getFakedValue(a any) (reflect.Value, error) {
21+
func (f *faker) getFakedValue(a any) (reflect.Value, error) {
2122
t := reflect.TypeOf(a)
2223
if t == nil {
2324
return reflect.Value{}, errEFaceNotAllowed
2425
}
2526
f.maxDepth--
2627
if f.maxDepth < 0 {
27-
return reflect.Value{}, fmt.Errorf("max_depth reached")
28+
return reflect.Value{}, errors.New("max_depth reached")
2829
}
2930
k := t.Kind()
3031
switch k {
@@ -176,7 +177,7 @@ func FakeObject(obj any, opts ...Option) error {
176177
reflectType := reflect.TypeOf(obj)
177178

178179
if reflectType.Kind() != reflect.Ptr {
179-
return fmt.Errorf("object is not a pointer")
180+
return errors.New("object is not a pointer")
180181
}
181182

182183
if reflect.ValueOf(obj).IsNil() {

faker/faker_test.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import (
66
"testing"
77
"time"
88

9+
"github.com/rs/zerolog"
910
"github.com/stretchr/testify/assert"
11+
"github.com/stretchr/testify/require"
1012
)
1113

1214
type testFakerStruct struct {
@@ -97,3 +99,63 @@ func TestFakerCanFakeNetIP(t *testing.T) {
9799
assert.NotEmpty(t, a.NestedComplex.IPAddress)
98100
assert.Equal(t, "1.1.1.1", a.NestedComplex.IPAddress.String())
99101
}
102+
103+
func TestMaxDepth(t *testing.T) {
104+
// Struct with nested structs
105+
a := struct {
106+
A struct {
107+
A struct {
108+
A struct {
109+
A struct {
110+
A struct {
111+
A struct {
112+
A struct {
113+
A struct {
114+
A struct {
115+
A struct {
116+
A struct {
117+
A struct {
118+
A struct {
119+
A struct {
120+
A struct {
121+
A struct {
122+
A struct {
123+
A string
124+
}
125+
}
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}
132+
}
133+
}
134+
}
135+
}
136+
}
137+
}
138+
}
139+
}
140+
}
141+
}{}
142+
143+
sink := &testLogSink{}
144+
testLogger := zerolog.New(sink)
145+
require.NoError(t, FakeObject(&a, WithLogger(testLogger)), "max depth reached")
146+
require.Equal(t, 1, len(sink.getLogs()))
147+
require.Contains(t, sink.getLogs()[0], "max_depth reached")
148+
}
149+
150+
type testLogSink struct {
151+
logs []string
152+
}
153+
154+
func (sink *testLogSink) Write(p []byte) (n int, err error) {
155+
sink.logs = append(sink.logs, string(p))
156+
return len(p), nil
157+
}
158+
159+
func (sink *testLogSink) getLogs() []string {
160+
return sink.logs
161+
}

helpers/remoteoauth/token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (t *cloudTokenSource) retrieveToken(ctx context.Context) (*oauth2.Token, er
114114
}
115115

116116
if oauthResp == nil {
117-
return nil, fmt.Errorf("missing oauth credentials in response")
117+
return nil, errors.New("missing oauth credentials in response")
118118
}
119119

120120
tok := &oauth2.Token{

internal/memdb/memdb.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package memdb
22

33
import (
44
"context"
5-
"fmt"
5+
"errors"
66
"sync"
77

88
"github.com/apache/arrow-go/v18/arrow"
@@ -108,7 +108,7 @@ func NewMemDBClient(ctx context.Context, l zerolog.Logger, spec []byte, options
108108
}
109109

110110
func NewMemDBClientErrOnNew(context.Context, zerolog.Logger, []byte, plugin.NewClientOptions) (plugin.Client, error) {
111-
return nil, fmt.Errorf("newTestDestinationMemDBClientErrOnNew")
111+
return nil, errors.New("newTestDestinationMemDBClientErrOnNew")
112112
}
113113

114114
func (c *client) overwrite(table *schema.Table, record arrow.Record) {
@@ -211,12 +211,12 @@ func (c *client) migrate(_ context.Context, table *schema.Table) {
211211

212212
func (c *client) Write(ctx context.Context, msgs <-chan message.WriteMessage) error {
213213
if c.errOnWrite {
214-
return fmt.Errorf("errOnWrite")
214+
return errors.New("errOnWrite")
215215
}
216216
if c.blockingWrite {
217217
<-ctx.Done()
218218
if c.errOnWrite {
219-
return fmt.Errorf("errOnWrite")
219+
return errors.New("errOnWrite")
220220
}
221221
return nil
222222
}
@@ -235,7 +235,7 @@ func (c *client) Write(ctx context.Context, msgs <-chan message.WriteMessage) er
235235
sc := msg.Record.Schema()
236236
tableName, ok := sc.Metadata().GetValue(schema.MetadataTableName)
237237
if !ok {
238-
return fmt.Errorf("table name not found in schema metadata")
238+
return errors.New("table name not found in schema metadata")
239239
}
240240
table := c.tables[tableName]
241241
c.overwrite(table, msg.Record)

plugin/plugin.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugin
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"sync"
78

@@ -13,7 +14,7 @@ import (
1314
"github.com/santhosh-tekuri/jsonschema/v6"
1415
)
1516

16-
var ErrNotImplemented = fmt.Errorf("not implemented")
17+
var ErrNotImplemented = errors.New("not implemented")
1718

1819
type NewClientOptions struct {
1920
NoConnection bool
@@ -215,7 +216,7 @@ func (p *Plugin) SetLogger(logger zerolog.Logger) {
215216

216217
func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Tables, error) {
217218
if p.client == nil {
218-
return nil, fmt.Errorf("plugin not initialized")
219+
return nil, errors.New("plugin not initialized")
219220
}
220221
tables, err := p.client.Tables(ctx, options)
221222
if err != nil {
@@ -227,7 +228,7 @@ func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Table
227228
// Init initializes the plugin with the given spec.
228229
func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions) error {
229230
if !p.mu.TryLock() {
230-
return fmt.Errorf("plugin already in use")
231+
return errors.New("plugin already in use")
231232
}
232233
defer p.mu.Unlock()
233234
var err error
@@ -257,7 +258,7 @@ func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions
257258

258259
func (p *Plugin) Close(ctx context.Context) error {
259260
if !p.mu.TryLock() {
260-
return fmt.Errorf("plugin already in use")
261+
return errors.New("plugin already in use")
261262
}
262263
defer p.mu.Unlock()
263264
if p.client == nil {

plugin/plugin_destination.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugin
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

78
"github.com/apache/arrow-go/v18/arrow"
@@ -33,19 +34,19 @@ func (p *Plugin) WriteAll(ctx context.Context, resources []message.WriteMessage)
3334

3435
func (p *Plugin) Write(ctx context.Context, res <-chan message.WriteMessage) error {
3536
if p.client == nil {
36-
return fmt.Errorf("plugin is not initialized. call Init first")
37+
return errors.New("plugin is not initialized. call Init first")
3738
}
3839
return p.client.Write(ctx, res)
3940
}
4041

4142
// Read is read data from the requested table to the given channel, returned in the same format as the table
4243
func (p *Plugin) Read(ctx context.Context, table *schema.Table, res chan<- arrow.Record) error {
4344
if !p.mu.TryLock() {
44-
return fmt.Errorf("plugin already in use")
45+
return errors.New("plugin already in use")
4546
}
4647
defer p.mu.Unlock()
4748
if p.client == nil {
48-
return fmt.Errorf("plugin not initialized. call Init() first")
49+
return errors.New("plugin not initialized. call Init() first")
4950
}
5051
if err := p.client.Read(ctx, table, res); err != nil {
5152
return fmt.Errorf("failed to read: %w", err)

plugin/plugin_source.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugin
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67

78
"github.com/cloudquery/plugin-sdk/v4/glob"
@@ -88,11 +89,11 @@ func (p *Plugin) SyncAll(ctx context.Context, options SyncOptions) (message.Sync
8889
// Sync is syncing data from the requested tables in spec to the given channel
8990
func (p *Plugin) Sync(ctx context.Context, options SyncOptions, res chan<- message.SyncMessage) error {
9091
if !p.mu.TryLock() {
91-
return fmt.Errorf("plugin already in use")
92+
return errors.New("plugin already in use")
9293
}
9394
defer p.mu.Unlock()
9495
if p.client == nil {
95-
return fmt.Errorf("plugin not initialized. call Init() first")
96+
return errors.New("plugin not initialized. call Init() first")
9697
}
9798

9899
if err := p.client.Sync(ctx, options, res); err != nil {

0 commit comments

Comments
 (0)