From a78ff88c3d6916662963c6f8ab4ac693b714dd51 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 14 Feb 2023 20:54:01 +0800 Subject: [PATCH] *: upgrade golangci-linter (#41317) --- DEPS.bzl | 40 ++++++++++---------- ddl/table.go | 3 ++ expression/builtin_time.go | 3 ++ go.mod | 6 +-- go.sum | 14 +++---- planner/core/find_best_task.go | 1 - planner/core/memtable_predicate_extractor.go | 1 + plugin/plugin.go | 1 + util/chunk/disk_test.go | 3 ++ 9 files changed, 41 insertions(+), 31 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index f46224ad85dab..30efca4350886 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -1385,8 +1385,8 @@ def go_deps(): name = "com_github_go_toolsmith_astcopy", build_file_proto_mode = "disable", importpath = "github.com/go-toolsmith/astcopy", - sum = "h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0=", - version = "v1.0.2", + sum = "h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0=", + version = "v1.0.3", ) go_repository( name = "com_github_go_toolsmith_astequal", @@ -1606,8 +1606,8 @@ def go_deps(): name = "com_github_golangci_golangci_lint", build_file_proto_mode = "disable", importpath = "github.com/golangci/golangci-lint", - sum = "h1:M1bpDymgdaPKNzPwQdebCGki/nzvVkr2f/eUfk9C9oU=", - version = "v1.51.0", + sum = "h1:N5HD/x0ZrhJYsgKWyz7yJxxQ8JKR0Acc+FOP7QtGSAA=", + version = "v1.51.1", ) go_repository( name = "com_github_golangci_gosec", @@ -1812,8 +1812,8 @@ def go_deps(): name = "com_github_gordonklaus_ineffassign", build_file_proto_mode = "disable", importpath = "github.com/gordonklaus/ineffassign", - sum = "h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U=", - version = "v0.0.0-20210914165742-4cc7213b9bc8", + sum = "h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U=", + version = "v0.0.0-20230107090616-13ace0543b28", ) go_repository( name = "com_github_gorilla_context", @@ -2432,8 +2432,8 @@ def go_deps(): name = "com_github_junk1tm_musttag", build_file_proto_mode = "disable", importpath = "github.com/junk1tm/musttag", - sum = "h1:I8UHQkDj2u/MClcGU8PbMoYwhykiSQFEbXKKMjixPyk=", - version = "v0.4.3", + sum = "h1:VK4L7v7lvWAhKDDx0cUJgbb0UBNipYinv8pPeHJzH9Q=", + version = "v0.4.4", ) go_repository( @@ -3110,8 +3110,8 @@ def go_deps(): name = "com_github_nunnatsa_ginkgolinter", build_file_proto_mode = "disable", importpath = "github.com/nunnatsa/ginkgolinter", - sum = "h1:j4mzqx1hkE75mXHs3AUlWghZBi59c3GDWXp6zzcI+kE=", - version = "v0.7.1", + sum = "h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuYs02q1c=", + version = "v0.8.1", ) go_repository( @@ -3633,8 +3633,8 @@ def go_deps(): name = "com_github_ryanrolds_sqlclosecheck", build_file_proto_mode = "disable", importpath = "github.com/ryanrolds/sqlclosecheck", - sum = "h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw=", - version = "v0.3.0", + sum = "h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI=", + version = "v0.4.0", ) go_repository( @@ -3656,8 +3656,8 @@ def go_deps(): name = "com_github_sanposhiho_wastedassign_v2", build_file_proto_mode = "disable", importpath = "github.com/sanposhiho/wastedassign/v2", - sum = "h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA=", - version = "v2.0.6", + sum = "h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc=", + version = "v2.0.7", ) go_repository( name = "com_github_sasha_s_go_deadlock", @@ -3737,8 +3737,8 @@ def go_deps(): name = "com_github_shirou_gopsutil_v3", build_file_proto_mode = "disable_global", importpath = "github.com/shirou/gopsutil/v3", - sum = "h1:oG0ns6poeUSxf78JtOsfygNWuEHYYz8hnnNg7P04TJs=", - version = "v3.22.12", + sum = "h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4=", + version = "v3.23.1", ) go_repository( name = "com_github_shopify_goreferrer", @@ -3866,8 +3866,8 @@ def go_deps(): name = "com_github_sourcegraph_go_diff", build_file_proto_mode = "disable", importpath = "github.com/sourcegraph/go-diff", - sum = "h1:FEIBISvqa2IsyC4KQQBQ1Ef2QvweGUgEIjCdE3gz+zs=", - version = "v0.6.2-0.20221031073116-7ef5f68ebea1", + sum = "h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0=", + version = "v0.7.0", ) go_repository( @@ -4151,8 +4151,8 @@ def go_deps(): name = "com_github_tomarrell_wrapcheck_v2", build_file_proto_mode = "disable", importpath = "github.com/tomarrell/wrapcheck/v2", - sum = "h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA=", - version = "v2.7.0", + sum = "h1:qDzbir0xmoE+aNxGCPrn+rUSxAX+nG6vREgbbXAR81I=", + version = "v2.8.0", ) go_repository( name = "com_github_tommy_muehle_go_mnd_v2", diff --git a/ddl/table.go b/ddl/table.go index e867bd832c102..6cefd63a2e120 100644 --- a/ddl/table.go +++ b/ddl/table.go @@ -534,6 +534,9 @@ func (w *worker) recoverTable(t *meta.Meta, job *model.Job, recoverInfo *Recover failpoint.Inject("mockRecoverTableCommitErr", func(val failpoint.Value) { if val.(bool) && atomic.CompareAndSwapUint32(&mockRecoverTableCommitErrOnce, 0, 1) { err = failpoint.Enable(`tikvclient/mockCommitErrorOpt`, "return(true)") + if err != nil { + return + } } }) diff --git a/expression/builtin_time.go b/expression/builtin_time.go index 4349129e2dba6..d7354ed2c9fbc 100644 --- a/expression/builtin_time.go +++ b/expression/builtin_time.go @@ -3581,6 +3581,9 @@ func (c *addSubDateFunctionClass) getFunction(ctx sessionctx.Context, args []Exp argTps := []types.EvalType{dateEvalTp, intervalEvalTp, types.ETString} var bf baseBuiltinFunc bf, err = newBaseBuiltinFuncWithTp(ctx, c.funcName, args, resultEvalTp, argTps...) + if err != nil { + return nil, err + } bf.tp.SetType(resultTp) var resultFsp int diff --git a/go.mod b/go.mod index 09687001e28f1..0dee27eb9750b 100644 --- a/go.mod +++ b/go.mod @@ -41,14 +41,14 @@ require ( github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.4 github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 - github.com/golangci/golangci-lint v1.51.0 + github.com/golangci/golangci-lint v1.51.1 github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb github.com/golangci/misspell v0.4.0 github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 github.com/google/btree v1.1.2 github.com/google/pprof v0.0.0-20211122183932-1daafda22083 github.com/google/uuid v1.3.0 - github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 + github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 github.com/gorilla/mux v1.8.0 github.com/gostaticanalysis/forcetypeassert v0.1.0 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 @@ -82,7 +82,7 @@ require ( github.com/prometheus/common v0.39.0 github.com/prometheus/prometheus v0.0.0-20190525122359-d20e84d0fb64 github.com/sasha-s/go-deadlock v0.2.0 - github.com/shirou/gopsutil/v3 v3.22.12 + github.com/shirou/gopsutil/v3 v3.23.1 github.com/shurcooL/httpgzip v0.0.0-20190720172056-320755c1c1b0 github.com/soheilhy/cmux v0.1.5 github.com/spf13/cobra v1.6.1 diff --git a/go.sum b/go.sum index 02b512ade19d3..0740ddf13d547 100644 --- a/go.sum +++ b/go.sum @@ -383,8 +383,8 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.51.0 h1:M1bpDymgdaPKNzPwQdebCGki/nzvVkr2f/eUfk9C9oU= -github.com/golangci/golangci-lint v1.51.0/go.mod h1:7taIMcmZ5ksCuRruCV/mm8Ir3sE+bIuOHVCvt1B4hi4= +github.com/golangci/golangci-lint v1.51.1 h1:N5HD/x0ZrhJYsgKWyz7yJxxQ8JKR0Acc+FOP7QtGSAA= +github.com/golangci/golangci-lint v1.51.1/go.mod h1:hnyNNO3fJ2Rjwo6HM+VXvcmLkKDOuBAnR9gVlS1mW1E= github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb h1:Bi7BYmZVg4C+mKGi8LeohcP2GGUl2XJD4xCkJoZSaYc= github.com/golangci/gosec v0.0.0-20180901114220-8afd9cbb6cfb/go.mod h1:ON/c2UR0VAAv6ZEAFKhjCLplESSmRFfZcDLASbI1GWo= github.com/golangci/misspell v0.4.0 h1:KtVB/hTK4bbL/S6bs64rYyk8adjmh1BygbBiaAiX+a0= @@ -446,8 +446,8 @@ github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57Q github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20190301152420-fca40860790e/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= +github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= @@ -854,8 +854,8 @@ github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA= -github.com/shirou/gopsutil/v3 v3.22.12 h1:oG0ns6poeUSxf78JtOsfygNWuEHYYz8hnnNg7P04TJs= -github.com/shirou/gopsutil/v3 v3.22.12/go.mod h1:Xd7P1kwZcp5VW52+9XsirIKd/BROzbb2wdX3Kqlz9uI= +github.com/shirou/gopsutil/v3 v3.23.1 h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4= +github.com/shirou/gopsutil/v3 v3.23.1/go.mod h1:NN6mnm5/0k8jw4cBfCnJtr5L7ErOTg18tMNpgFkn0hA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -1286,7 +1286,7 @@ golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/planner/core/find_best_task.go b/planner/core/find_best_task.go index f9a4c6e094a81..60bc111c4fdc5 100644 --- a/planner/core/find_best_task.go +++ b/planner/core/find_best_task.go @@ -388,7 +388,6 @@ func (p *baseLogicalPlan) findBestTask(prop *property.PhysicalProperty, planCoun return invalidTask, 0, nil } - bestTask = invalidTask cntPlan = 0 // prop should be read only because its cached hashcode might be not consistent // when it is changed. So we clone a new one for the temporary changes. diff --git a/planner/core/memtable_predicate_extractor.go b/planner/core/memtable_predicate_extractor.go index dc9feed44c2a8..46a5fdb8eceef 100644 --- a/planner/core/memtable_predicate_extractor.go +++ b/planner/core/memtable_predicate_extractor.go @@ -1007,6 +1007,7 @@ func (e *MetricSummaryTableExtractor) Extract( names []*types.FieldName, predicates []expression.Expression, ) (remained []expression.Expression) { + //nolint: ineffassign remained, quantileSkip, quantiles := e.extractCol(schema, names, predicates, "quantile", false) remained, metricsNameSkip, metricsNames := e.extractCol(schema, names, predicates, "metrics_name", true) e.SkipRequest = quantileSkip || metricsNameSkip diff --git a/plugin/plugin.go b/plugin/plugin.go index 4fded51d3f080..249e6bae25b17 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -184,6 +184,7 @@ func Load(ctx context.Context, cfg Config) (err error) { logutil.Logger(ctx).Warn("validate plugin fail and disable plugin", zap.String("plugin", tiPlugins.plugins[kind][i].Name), zap.Error(err)) tiPlugins.plugins[kind][i].State = Disable + //nolint: ineffassign err = nil continue } diff --git a/util/chunk/disk_test.go b/util/chunk/disk_test.go index 1217e86f31944..6f406e853707f 100644 --- a/util/chunk/disk_test.go +++ b/util/chunk/disk_test.go @@ -178,6 +178,9 @@ func newListInDiskWriteDisk(fieldTypes []*types.FieldType) (*listInDiskWriteDisk func (l *listInDiskWriteDisk) GetRow(ptr RowPtr) (row Row, err error) { err = l.flushForTest() + if err != nil { + return + } off, err := l.getOffset(ptr.ChkIdx, ptr.RowIdx) if err != nil { return