Skip to content

Commit

Permalink
chore(deps): Update dependency golangci/golangci-lint to v1.64.5 (#2087)
Browse files Browse the repository at this point in the history
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=-->
  • Loading branch information
cq-bot authored Mar 5, 2025
1 parent 4faff6a commit 9fd9da4
Show file tree
Hide file tree
Showing 15 changed files with 110 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.63.4
version: v1.64.5
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ linters:
- unconvert
- unparam
- unused
issues:
max-issues-per-linter: 0
max-same-issues: 0
5 changes: 3 additions & 2 deletions configtype/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package configtype

import (
"encoding/json"
"errors"
"fmt"
"math"
"regexp"
Expand Down Expand Up @@ -212,13 +213,13 @@ func parseTimeDuration(s string) (timeDuration, error) {
inValue = false
case part == "ago":
if d.sign != 0 {
return timeDuration{}, fmt.Errorf("invalid duration format: more than one sign specifier")
return timeDuration{}, errors.New("invalid duration format: more than one sign specifier")
}

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

inSign = true
Expand Down
9 changes: 5 additions & 4 deletions faker/faker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package faker

import (
"encoding/json"
"errors"
"fmt"
"math/rand"
"reflect"
Expand All @@ -15,16 +16,16 @@ type faker struct {
logger zerolog.Logger
}

var errEFaceNotAllowed = fmt.Errorf("any not allowed")
var errEFaceNotAllowed = errors.New("any not allowed")

func (f faker) getFakedValue(a any) (reflect.Value, error) {
func (f *faker) getFakedValue(a any) (reflect.Value, error) {
t := reflect.TypeOf(a)
if t == nil {
return reflect.Value{}, errEFaceNotAllowed
}
f.maxDepth--
if f.maxDepth < 0 {
return reflect.Value{}, fmt.Errorf("max_depth reached")
return reflect.Value{}, errors.New("max_depth reached")
}
k := t.Kind()
switch k {
Expand Down Expand Up @@ -176,7 +177,7 @@ func FakeObject(obj any, opts ...Option) error {
reflectType := reflect.TypeOf(obj)

if reflectType.Kind() != reflect.Ptr {
return fmt.Errorf("object is not a pointer")
return errors.New("object is not a pointer")
}

if reflect.ValueOf(obj).IsNil() {
Expand Down
62 changes: 62 additions & 0 deletions faker/faker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"testing"
"time"

"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

type testFakerStruct struct {
Expand Down Expand Up @@ -97,3 +99,63 @@ func TestFakerCanFakeNetIP(t *testing.T) {
assert.NotEmpty(t, a.NestedComplex.IPAddress)
assert.Equal(t, "1.1.1.1", a.NestedComplex.IPAddress.String())
}

func TestMaxDepth(t *testing.T) {
// Struct with nested structs
a := struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A struct {
A string
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}{}

sink := &testLogSink{}
testLogger := zerolog.New(sink)
require.NoError(t, FakeObject(&a, WithLogger(testLogger)), "max depth reached")
require.Equal(t, 1, len(sink.getLogs()))
require.Contains(t, sink.getLogs()[0], "max_depth reached")
}

type testLogSink struct {
logs []string
}

func (sink *testLogSink) Write(p []byte) (n int, err error) {
sink.logs = append(sink.logs, string(p))
return len(p), nil
}

func (sink *testLogSink) getLogs() []string {
return sink.logs
}
2 changes: 1 addition & 1 deletion helpers/remoteoauth/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (t *cloudTokenSource) retrieveToken(ctx context.Context) (*oauth2.Token, er
}

if oauthResp == nil {
return nil, fmt.Errorf("missing oauth credentials in response")
return nil, errors.New("missing oauth credentials in response")
}

tok := &oauth2.Token{
Expand Down
10 changes: 5 additions & 5 deletions internal/memdb/memdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package memdb

import (
"context"
"fmt"
"errors"
"sync"

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

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

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

func (c *client) Write(ctx context.Context, msgs <-chan message.WriteMessage) error {
if c.errOnWrite {
return fmt.Errorf("errOnWrite")
return errors.New("errOnWrite")
}
if c.blockingWrite {
<-ctx.Done()
if c.errOnWrite {
return fmt.Errorf("errOnWrite")
return errors.New("errOnWrite")
}
return nil
}
Expand All @@ -235,7 +235,7 @@ func (c *client) Write(ctx context.Context, msgs <-chan message.WriteMessage) er
sc := msg.Record.Schema()
tableName, ok := sc.Metadata().GetValue(schema.MetadataTableName)
if !ok {
return fmt.Errorf("table name not found in schema metadata")
return errors.New("table name not found in schema metadata")
}
table := c.tables[tableName]
c.overwrite(table, msg.Record)
Expand Down
9 changes: 5 additions & 4 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin

import (
"context"
"errors"
"fmt"
"sync"

Expand All @@ -13,7 +14,7 @@ import (
"github.com/santhosh-tekuri/jsonschema/v6"
)

var ErrNotImplemented = fmt.Errorf("not implemented")
var ErrNotImplemented = errors.New("not implemented")

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

func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Tables, error) {
if p.client == nil {
return nil, fmt.Errorf("plugin not initialized")
return nil, errors.New("plugin not initialized")
}
tables, err := p.client.Tables(ctx, options)
if err != nil {
Expand All @@ -227,7 +228,7 @@ func (p *Plugin) Tables(ctx context.Context, options TableOptions) (schema.Table
// Init initializes the plugin with the given spec.
func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions) error {
if !p.mu.TryLock() {
return fmt.Errorf("plugin already in use")
return errors.New("plugin already in use")
}
defer p.mu.Unlock()
var err error
Expand Down Expand Up @@ -257,7 +258,7 @@ func (p *Plugin) Init(ctx context.Context, spec []byte, options NewClientOptions

func (p *Plugin) Close(ctx context.Context) error {
if !p.mu.TryLock() {
return fmt.Errorf("plugin already in use")
return errors.New("plugin already in use")
}
defer p.mu.Unlock()
if p.client == nil {
Expand Down
7 changes: 4 additions & 3 deletions plugin/plugin_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin

import (
"context"
"errors"
"fmt"

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

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

// Read is read data from the requested table to the given channel, returned in the same format as the table
func (p *Plugin) Read(ctx context.Context, table *schema.Table, res chan<- arrow.Record) error {
if !p.mu.TryLock() {
return fmt.Errorf("plugin already in use")
return errors.New("plugin already in use")
}
defer p.mu.Unlock()
if p.client == nil {
return fmt.Errorf("plugin not initialized. call Init() first")
return errors.New("plugin not initialized. call Init() first")
}
if err := p.client.Read(ctx, table, res); err != nil {
return fmt.Errorf("failed to read: %w", err)
Expand Down
5 changes: 3 additions & 2 deletions plugin/plugin_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package plugin

import (
"context"
"errors"
"fmt"

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

if err := p.client.Sync(ctx, options, res); err != nil {
Expand Down
12 changes: 6 additions & 6 deletions premium/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,15 @@ func awsMarketplaceProductCode() string {

func (u *BatchUpdater) Increase(rows uint32) error {
if u.usageIncreaseMethod == UsageIncreaseMethodBreakdown {
return fmt.Errorf("mixing usage increase methods is not allowed, use IncreaseForTable instead")
return errors.New("mixing usage increase methods is not allowed, use IncreaseForTable instead")
}

if rows <= 0 {
return fmt.Errorf("rows must be greater than zero got %d", rows)
}

if u.isClosed {
return fmt.Errorf("usage updater is closed")
return errors.New("usage updater is closed")
}

u.Lock()
Expand All @@ -364,15 +364,15 @@ func (u *BatchUpdater) Increase(rows uint32) error {

func (u *BatchUpdater) IncreaseForTable(table string, rows uint32) error {
if u.usageIncreaseMethod == UsageIncreaseMethodTotal {
return fmt.Errorf("mixing usage increase methods is not allowed, use Increase instead")
return errors.New("mixing usage increase methods is not allowed, use Increase instead")
}

if rows <= 0 {
return fmt.Errorf("rows must be greater than zero got %d", rows)
}

if u.isClosed {
return fmt.Errorf("usage updater is closed")
return errors.New("usage updater is closed")
}

u.Lock()
Expand Down Expand Up @@ -696,7 +696,7 @@ func (u *BatchUpdater) getTeamNameByTokenType(tokenType auth.TokenType) (string,
return "", fmt.Errorf("failed to get team name from config: %w", err)
}
if teamName == "" {
return "", fmt.Errorf("team name not set. Hint: use `cloudquery switch <team>`")
return "", errors.New("team name not set. Hint: use `cloudquery switch <team>`")
}
return teamName, nil
case auth.APIKey:
Expand All @@ -716,7 +716,7 @@ func (u *BatchUpdater) getTeamNameByTokenType(tokenType auth.TokenType) (string,
if team == "" {
switch tokenType {
case auth.SyncRunAPIKey, auth.SyncTestConnectionAPIKey:
return "", fmt.Errorf("_CQ_TEAM_NAME environment variable not set")
return "", errors.New("_CQ_TEAM_NAME environment variable not set")
}
return "", fmt.Errorf("unsupported token type: %v", tokenType)
}
Expand Down
3 changes: 2 additions & 1 deletion schema/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema
import (
"context"
"encoding/json"
"errors"
"fmt"
"regexp"
"slices"
Expand Down Expand Up @@ -177,7 +178,7 @@ func NewTableFromArrowSchema(sc *arrow.Schema) (*Table, error) {
tableMD := sc.Metadata()
name, found := tableMD.GetValue(MetadataTableName)
if !found {
return nil, fmt.Errorf("missing table name")
return nil, errors.New("missing table name")
}
description, _ := tableMD.GetValue(MetadataTableDescription)
constraintName, _ := tableMD.GetValue(MetadataConstraintName)
Expand Down
Loading

0 comments on commit 9fd9da4

Please sign in to comment.