Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-04-23 12:49:34 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-04-23 12:49:34 +0300
commitfee093e7c786e4b1132cb87ab13175aef07265dc (patch)
treeac3bf85c9184ffa6b0348b741c654ec6ab0293bd
parentd68e4632823caa55c491459927b78efec7ede7ae (diff)
parent4838715325eb7208c768724e1ddcd4da0c8f3d9a (diff)
Merge branch 'pks-golangci-lint-1.39.0' into 'master'
golangci: Upgrade to v1.39.0 See merge request gitlab-org/gitaly!3397
-rw-r--r--.golangci.yml12
-rw-r--r--Makefile2
-rw-r--r--internal/git/gittest/delta_islands.go4
-rw-r--r--internal/gitaly/service/operations/branches_test.go12
-rw-r--r--internal/gitaly/service/smarthttp/receive_pack_test.go2
-rw-r--r--internal/praefect/nodes/manager_test.go2
-rw-r--r--internal/streamcache/cache_test.go2
7 files changed, 22 insertions, 14 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 5273f55d7..bbcc14a28 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -10,13 +10,14 @@ linters:
enable:
- deadcode
- errcheck
+ - exportloopref
- gci
- goimports
- golint
- gosimple
- govet
- ineffassign
- - maligned
+ - makezero
- megacheck
- misspell
- noctx
@@ -29,6 +30,7 @@ linters:
- unconvert
- unused
- varcheck
+ - wastedassign
issues:
exclude-use-default: false
@@ -788,7 +790,7 @@ issues:
- linters:
- errcheck
path: "internal/supervisor/supervisor.go"
- text: "Error return value of `cmd.Process.Kill` is not checked"
+ text: "Error return value of `(cmd.Process.Kill)?` is not checked"
- linters:
- errcheck
path: "internal/gitaly/service/commit/find_commits.go"
@@ -824,15 +826,15 @@ issues:
- linters:
- errcheck
path: "cmd/praefect/main.go"
- text: "Error return value of `printfErr` is not checked"
+ text: "Error return value is not checked"
- linters:
- errcheck
path: "cmd/praefect/subcmd.go"
- text: "Error return value of `printfErr` is not checked"
+ text: "Error return value is not checked"
- linters:
- errcheck
path: "cmd/praefect/subcmd_sqldown.go"
- text: "Error return value of `printfErr` is not checked"
+ text: "Error return value is not checked"
- linters:
- errcheck
path: "internal/git/stats/analyzehttp.go"
diff --git a/Makefile b/Makefile
index d576eb121..9af259f2b 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ GO_LDFLAGS := -ldflags '-X ${GITALY_PACKAGE}/internal/version.version=${G
GO_BUILD_TAGS := tracer_static,tracer_static_jaeger,continuous_profiler_stackdriver,static,system_libgit2
# Dependency versions
-GOLANGCI_LINT_VERSION ?= 1.33.0
+GOLANGCI_LINT_VERSION ?= 1.39.0
GOCOVER_COBERTURA_VERSION ?= aaee18c8195c3f2d90e5ef80ca918d265463842a
GOIMPORTS_VERSION ?= 2538eef75904eff384a2551359968e40c207d9d2
GO_JUNIT_REPORT_VERSION ?= 984a47ca6b0a7d704c4b589852051b4d7865aa17
diff --git a/internal/git/gittest/delta_islands.go b/internal/git/gittest/delta_islands.go
index d3652e369..4d1aab9e6 100644
--- a/internal/git/gittest/delta_islands.go
+++ b/internal/git/gittest/delta_islands.go
@@ -5,6 +5,7 @@ import (
"crypto/rand"
"fmt"
"io"
+ "io/ioutil"
"strings"
"testing"
@@ -18,8 +19,7 @@ import (
// https://github.com/git/git/blob/master/t/t5320-delta-islands.sh .
func TestDeltaIslands(t *testing.T, repoPath string, repack func() error) {
// Create blobs that we expect Git to use delta compression on.
- blob1 := make([]byte, 100000)
- _, err := io.ReadFull(rand.Reader, blob1)
+ blob1, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 100000))
require.NoError(t, err)
blob2 := append(blob1, "\nblob 2"...)
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index 1d0ecbff9..87977aa02 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -154,8 +154,12 @@ func TestUserCreateBranchWithTransaction(t *testing.T) {
srv.Start(t)
defer srv.Stop()
- go srv.GrpcServer().Serve(internalListener)
- go srv.GrpcServer().Serve(tcpSocket)
+ go func() {
+ require.NoError(t, srv.GrpcServer().Serve(internalListener))
+ }()
+ go func() {
+ require.NoError(t, srv.GrpcServer().Serve(tcpSocket))
+ }()
testcases := []struct {
desc string
@@ -549,7 +553,9 @@ func TestUserDeleteBranch_transaction(t *testing.T) {
srv.Start(t)
defer srv.Stop()
- go srv.GrpcServer().Serve(internalListener)
+ go func() {
+ require.NoError(t, srv.GrpcServer().Serve(internalListener))
+ }()
praefect := metadata.PraefectServer{
SocketPath: fmt.Sprintf("unix://" + internalSocket),
diff --git a/internal/gitaly/service/smarthttp/receive_pack_test.go b/internal/gitaly/service/smarthttp/receive_pack_test.go
index 2b16b6f57..940605bbe 100644
--- a/internal/gitaly/service/smarthttp/receive_pack_test.go
+++ b/internal/gitaly/service/smarthttp/receive_pack_test.go
@@ -519,7 +519,7 @@ func testPostReceiveWithTransactionsViaPraefect(t *testing.T, ctx context.Contex
require.NoError(t, err)
go func() {
- gitalyServer.GrpcServer().Serve(internalListener)
+ require.NoError(t, gitalyServer.GrpcServer().Serve(internalListener))
}()
client, conn := newSmartHTTPClient(t, "unix://"+gitalyServer.Socket(), cfg.Auth.Token)
diff --git a/internal/praefect/nodes/manager_test.go b/internal/praefect/nodes/manager_test.go
index dac640310..a550049de 100644
--- a/internal/praefect/nodes/manager_test.go
+++ b/internal/praefect/nodes/manager_test.go
@@ -137,7 +137,7 @@ func TestManagerFailoverDisabledElectionStrategySQL(t *testing.T) {
healthSrv.SetServingStatus("", grpc_health_v1.HealthCheckResponse_UNKNOWN)
nm.checkShards()
- shard, err = nm.GetShard(ctx, virtualStorageName)
+ _, err = nm.GetShard(ctx, virtualStorageName)
require.Error(t, err)
require.Equal(t, ErrPrimaryNotHealthy, err)
}
diff --git a/internal/streamcache/cache_test.go b/internal/streamcache/cache_test.go
index 9770c4e89..78a87632a 100644
--- a/internal/streamcache/cache_test.go
+++ b/internal/streamcache/cache_test.go
@@ -189,7 +189,7 @@ func TestCache_scope(t *testing.T) {
var created bool
reader[i], created, err = cache[i].FindOrCreate(key, writeString(input[i]))
require.NoError(t, err)
- defer func(i int) { reader[i].Close() }(i)
+ defer func(i int) { require.NoError(t, reader[i].Close()) }(i)
require.True(t, created)
}