Skip to content

Commit

Permalink
switched version of golangci-lint from v1.55.2 to 1.60.3
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Sep 4, 2024
1 parent 7f269c8 commit 0eda664
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
workflow_dispatch:
env:
GOLANGCI_LINT_VERSION: v1.55.2
GOLANGCI_LINT_VERSION: v1.60.3
jobs:
golangci:
name: golangci-lint
Expand Down
35 changes: 17 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ run:
#build-tags:
# - mytag

# which dirs to skip: they won't be analyzed;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# skip-dirs:
skip-dirs-use-default: false

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
Expand All @@ -30,7 +22,7 @@ run:
# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
format: colored-line-number
formats: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
Expand All @@ -51,10 +43,7 @@ linters-settings:
check-blank: false
govet:
# report about shadowed variables
check-shadowing: true
golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
shadow: true
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
Expand Down Expand Up @@ -222,22 +211,28 @@ linters:
- cyclop
- depguard
- dupl
- err113
- exhaustive
- exhaustivestruct
- exhaustruct
- fatcontext
- forbidigo
- gochecknoglobals
- gocognit
- gocritic
- godot
- goerr113
- golint
- gomnd
- gosec
- interfacebloat
- intrange
- ireturn
- maintidx
- mnd
- nonamedreturns
- paralleltest
- structcheck
- perfsprint
- predeclared
- testableexamples
- testifylint
- testpackage
- thelper
- varnamelen
Expand Down Expand Up @@ -267,6 +262,11 @@ issues:
# Default value for this option is true.
exclude-use-default: true

# Enables exclude of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
exclude-dirs-use-default: false

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

Expand Down Expand Up @@ -302,7 +302,6 @@ issues:
text: "ydb.Connection is deprecated"
- path: examples
linters:
- gomnd
- funlen
- path: tests
linters:
Expand Down
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module examples

go 1.22
go 1.23

require (
github.com/golang-jwt/jwt/v4 v4.5.0
Expand Down
16 changes: 8 additions & 8 deletions examples/ttl_readtable/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func deleteExpiredRange(ctx context.Context, c table.Client, prefix string, time
// As single key range usually represents a single shard, so we batch deletions here
// without introducing distributed transactions.
var (
docIds []uint64
docIDs []uint64
docID uint64
ts uint64
)
Expand All @@ -113,20 +113,20 @@ func deleteExpiredRange(ctx context.Context, c table.Client, prefix string, time
}

if ts <= timestamp {
docIds = append(docIds, docID)
docIDs = append(docIDs, docID)
}
if len(docIds) >= deleteBatchSize {
if err := deleteExpiredDocuments(ctx, c, prefix, docIds, timestamp); err != nil {
if len(docIDs) >= deleteBatchSize {
if err := deleteExpiredDocuments(ctx, c, prefix, docIDs, timestamp); err != nil {
return err
}
docIds = []uint64{}
docIDs = []uint64{}
}
}
if len(docIds) > 0 {
if err := deleteExpiredDocuments(ctx, c, prefix, docIds, timestamp); err != nil {
if len(docIDs) > 0 {
if err := deleteExpiredDocuments(ctx, c, prefix, docIDs, timestamp); err != nil {
return err
}
docIds = []uint64{}
docIDs = []uint64{}
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/balancer/connections_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestSelectRandomConnection(t *testing.T) {
case "2":
second++
default:
t.Errorf(c.Endpoint().Address())
t.Error(c.Endpoint().Address())
}
}
require.Equal(t, 100, first+second)
Expand Down
1 change: 0 additions & 1 deletion internal/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func (c *conn) park(ctx context.Context) (err error) {
}

err = c.close(ctx)

if err != nil {
return xerrors.WithStackTrace(err)
}
Expand Down
3 changes: 0 additions & 3 deletions internal/conn/grpc_client_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (s *grpcClientStream) CloseSend() (err error) {
defer stop()

err = s.stream.CloseSend()

if err != nil {
if xerrors.IsContextError(err) {
return xerrors.WithStackTrace(err)
Expand Down Expand Up @@ -88,7 +87,6 @@ func (s *grpcClientStream) SendMsg(m interface{}) (err error) {
defer stop()

err = s.stream.SendMsg(m)

if err != nil {
if xerrors.IsContextError(err) {
return xerrors.WithStackTrace(err)
Expand Down Expand Up @@ -144,7 +142,6 @@ func (s *grpcClientStream) RecvMsg(m interface{}) (err error) { //nolint:funlen
defer stop()

err = s.stream.RecvMsg(m)

if err != nil {
if xerrors.Is(err, io.EOF) {
return io.EOF
Expand Down
1 change: 0 additions & 1 deletion internal/credentials/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ func GetSupportedOauth2TokenExchangeJwtAlgorithms() []string {
return algs
}

//nolint:musttag
type stringOrArrayConfig struct {
Values []string
}
Expand Down
2 changes: 1 addition & 1 deletion internal/query/execute_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func readMaterializedResultSet(ctx context.Context, r *streamResult) (_ *materia

var rows []query.Row
for {
row, err := rs.nextRow(ctx) //nolint:govet
row, err := rs.nextRow(ctx)
if err != nil {
if xerrors.Is(err, io.EOF) {
break
Expand Down
1 change: 1 addition & 0 deletions internal/query/result_set_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ func TestResultSetRange(t *testing.T) {
})
t.Run("CanceledContext", func(t *testing.T) {
childCtx, cancel := context.WithCancel(xtest.Context(t))
defer cancel()
stream := NewMockQueryService_ExecuteQueryClient(ctrl)
stream.EXPECT().Recv().Return(&Ydb_Query.ExecuteQueryResponsePart{
Status: Ydb.StatusIds_SUCCESS,
Expand Down
2 changes: 1 addition & 1 deletion internal/table/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ func TestSessionPoolGetPut(t *testing.T) {
testutil.TableDeleteSession: func(interface{}) (proto.Message, error) {
deleted++

return nil, nil
return nil, nil //nolint:nilnil
},
},
),
Expand Down
1 change: 0 additions & 1 deletion internal/table/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func do(

return op(xcontext.MarkRetryCall(ctx), s)
}()

if err != nil {
return xerrors.WithStackTrace(err)
}
Expand Down
1 change: 0 additions & 1 deletion internal/topic/topicreadercommon/one_time_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (s *oneTimeReader) Read(p []byte) (n int, err error) {
}

n, err = s.reader.Read(p)

if err != nil {
s.err = err
s.reader = nil
Expand Down
2 changes: 0 additions & 2 deletions internal/topic/topicwriterinternal/writer_grpc_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func (t *topicWriterOperationUnavailable) StreamWrite(server Ydb_Topic_V1.TopicS
},
},
})

if err != nil {
return fmt.Errorf("failed to send error response: %w", err)
}
Expand Down Expand Up @@ -125,7 +124,6 @@ func (t *topicWriterOperationUnavailable) StreamWrite(server Ydb_Topic_V1.TopicS
},
},
})

if err != nil {
return fmt.Errorf("failed to sent write ack: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/value/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@ func (v *variantValue) Yql() string {
case *types.VariantStruct:
fmt.Fprintf(buffer, "%q", t.Field(int(v.idx)).Name)
case *types.VariantTuple:
fmt.Fprintf(buffer, "\""+strconv.FormatUint(uint64(v.idx), 10)+"\"")
fmt.Fprint(buffer, "\""+strconv.FormatUint(uint64(v.idx), 10)+"\"")
}
buffer.WriteByte(',')
buffer.WriteString(v.Type().Yql())
Expand Down
2 changes: 1 addition & 1 deletion internal/xerrors/join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestUnwrapJoined(t *testing.T) {

joined := Join(err1, err2)

unwrappable := joined.(interface{ Unwrap() []error }) //nolint:errorlint
unwrappable := joined.(interface{ Unwrap() []error })
inners := unwrappable.Unwrap()
assert.Contains(t, inners, err1)
assert.Contains(t, inners, err2)
Expand Down
1 change: 0 additions & 1 deletion tests/slo/database/sql/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"slo/internal/generator"
)

//nolint:goconst
const (
createTemplate = `
CREATE TABLE ` + "`%s`" + ` (
Expand Down
2 changes: 1 addition & 1 deletion tests/slo/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module slo

go 1.21
go 1.23

require (
github.com/prometheus/client_golang v1.14.0
Expand Down
1 change: 0 additions & 1 deletion tests/slo/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type Config struct {
ShutdownTime int
}

//nolint:gomnd
func New() (*Config, error) {
cfg := &Config{}

Expand Down
10 changes: 5 additions & 5 deletions tests/slo/internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ func New(url, label, jobName string) (*Metrics, error) {
}

m.oks = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
prometheus.GaugeOpts{ //nolint:promlinter
Name: "oks",
Help: "amount of OK requests",
},
[]string{"jobName"},
)
m.notOks = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
prometheus.GaugeOpts{ //nolint:promlinter
Name: "not_oks",
Help: "amount of not OK requests",
},
[]string{"jobName"},
)
m.inflight = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
prometheus.GaugeOpts{ //nolint:promlinter
Name: "inflight",
Help: "amount of requests in flight",
},
[]string{"jobName"},
)
m.latencies = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
prometheus.SummaryOpts{ //nolint:promlinter
Name: "latency",
Help: "summary of latencies in ms",
Objectives: map[float64]float64{
Expand All @@ -68,7 +68,7 @@ func New(url, label, jobName string) (*Metrics, error) {
[]string{"status", "jobName"},
)
m.attempts = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
prometheus.HistogramOpts{ //nolint:promlinter
Name: "attempts",
Help: "summary of amount for request",
Buckets: prometheus.LinearBuckets(1, 1, 10), //nolint:gomnd
Expand Down
1 change: 0 additions & 1 deletion tests/slo/native/table/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"slo/internal/generator"
)

//nolint:goconst
const (
upsertTemplate = `
PRAGMA TablePathPrefix("%s");
Expand Down

0 comments on commit 0eda664

Please sign in to comment.