diff --git a/.golangci.yml b/.golangci.yml index a33d726ab..5854f1228 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -104,6 +104,9 @@ issues: - path: \.pb\.go linters: - gofmt + - path: reporter.go + linters: + - musttag - path: _test\.go|testing|tests|test_env|fshasher|fault linters: - contextcheck @@ -115,6 +118,7 @@ issues: - gocognit - gomnd - gosec + - musttag - nestif - revive - nolintlint diff --git a/internal/serverapi/serverapi.go b/internal/serverapi/serverapi.go index 507916d09..38b97076d 100644 --- a/internal/serverapi/serverapi.go +++ b/internal/serverapi/serverapi.go @@ -123,6 +123,8 @@ type CheckRepositoryExistsRequest struct { } // ConnectRepositoryRequest contains request to connect to a repository. +// +//nolint:musttag // false positive type ConnectRepositoryRequest struct { Storage blob.ConnectionInfo `json:"storage"` Password string `json:"password"` diff --git a/internal/sparsefile/sparsefile.go b/internal/sparsefile/sparsefile.go index 9e538e7c2..866f233c8 100644 --- a/internal/sparsefile/sparsefile.go +++ b/internal/sparsefile/sparsefile.go @@ -3,7 +3,6 @@ import ( "io" - "os" "github.com/pkg/errors" @@ -27,7 +26,7 @@ func copyBuffer(dst io.WriteSeeker, src io.Reader, buf []byte) (written int64, e if nr > 0 { //nolint:nestif // If non-zero data is read, write it. Otherwise, skip forwards. if isAllZero(buf) { - dst.Seek(int64(nr), os.SEEK_CUR) //nolint:errcheck + dst.Seek(int64(nr), io.SeekCurrent) //nolint:errcheck written += int64(nr) continue diff --git a/repo/blob/config.go b/repo/blob/config.go index 215fe1282..ac6cb5ed3 100644 --- a/repo/blob/config.go +++ b/repo/blob/config.go @@ -7,6 +7,8 @@ ) // ConnectionInfo represents JSON-serializable configuration of a blob storage. +// +//nolint:musttag // we use custom JSON marshaling. type ConnectionInfo struct { Type string Config interface{} diff --git a/repo/ecc/ecc_rs_crc.go b/repo/ecc/ecc_rs_crc.go index 91df05bc5..beb703656 100644 --- a/repo/ecc/ecc_rs_crc.go +++ b/repo/ecc/ecc_rs_crc.go @@ -402,8 +402,7 @@ type sizesInfo struct { enc reedsolomon.Encoder } -//nolint:unused // Used in tests -func (s *sizesInfo) computeFinalFileSize(size int) int { +func computeFinalFileSize(s *sizesInfo, size int) int { if s.StorePadding { return computeFinalFileSizeWithPadding(s.DataShards, s.ParityShards, s.ShardSize, s.Blocks) } @@ -415,7 +414,6 @@ func computeFinalFileSizeWithPadding(dataShards, parityShards, shardSize, blocks return (parityShards + dataShards) * (crcSize + shardSize) * blocks } -//nolint:unused // Used in tests func computeFinalFileSizeWithoutPadding(inputSize, parityShards, shardSize, blocks int) int { sizePlusLength := lengthSize + inputSize return parityShards*(crcSize+shardSize)*blocks + sizePlusLength + ceilInt(sizePlusLength, shardSize)*crcSize diff --git a/repo/ecc/ecc_rs_crc_test.go b/repo/ecc/ecc_rs_crc_test.go index 92ca8a5c6..2c6392898 100644 --- a/repo/ecc/ecc_rs_crc_test.go +++ b/repo/ecc/ecc_rs_crc_test.go @@ -21,7 +21,7 @@ func Test_RsCrc32_AssertSizeAlwaysGrow(t *testing.T) { for i := 1; i < 10*1024*1024; i++ { sizes := impl.computeSizesFromOriginal(i) - total := sizes.computeFinalFileSize(i) + total := computeFinalFileSize(&sizes, i) //nolint:gocritic // println(fmt.Sprintf("%-8v -> b:%-4v s:%-8v t:%-8v", i, sizes.Blocks, sizes.ShardSize, total)) diff --git a/repo/format/repository_config.go b/repo/format/repository_config.go index 69d81b306..5fd58b1a8 100644 --- a/repo/format/repository_config.go +++ b/repo/format/repository_config.go @@ -10,6 +10,8 @@ // RepositoryConfig describes the format of objects in a repository. // The contents of this object are stored encrypted since they contain sensitive key material. +// +//nolint:musttag // false positive type RepositoryConfig struct { ContentFormat ObjectFormat diff --git a/tools/gettool/checksums.txt b/tools/gettool/checksums.txt index 1f07ee91b..456c11433 100644 --- a/tools/gettool/checksums.txt +++ b/tools/gettool/checksums.txt @@ -8,12 +8,12 @@ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-64bit.tar.gz: f9185f6d14eb84d9029d59cdd8a977f2f0be334c4f9d38f2099e56a0c0734731 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-ARM64.tar.gz: 99a5b4738528d4858a0237199eabc7aee77674c8c7edcfe269efb4b515566cec https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_windows-64bit.zip: 8d79db4f24fbf023c64862c37d09291ac216875dad91e71dd8753cb5883e4274 -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-darwin-amd64.tar.gz: 0f615fb8c364f6e4a213f2ed2ff7aa1fc2b208addf29511e89c03534067bbf57 -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-darwin-arm64.tar.gz: 3ca9753d7804b34f9165427fbe339dbea69bd80be8a10e3f02c6037393b2e1c4 -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-amd64.tar.gz: 4ba1dc9dbdf05b7bdc6f0e04bdfe6f63aa70576f51817be1b2540bbce017b69a -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-arm64.tar.gz: 3ea0a6d5946340f6831646e2c67a317dd9b35bdc4e09b2df953a86f09ba05d74 -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-linux-armv6.tar.gz: 980832f12fbdd0a8e636666839b168c2bbf0ca573ff50b042d3977f65c4987d7 -https://github.com/golangci/golangci-lint/releases/download/v1.50.1/golangci-lint-1.50.1-windows-amd64.zip: 8c2da214884db02fb7f3d929672c515ae3b9d10defad4dd661c4ab365a316d68 +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-darwin-amd64.tar.gz: fba08acc4027f69f07cef48fbff70b8a7ecdfaa1c2aba9ad3fb31d60d9f5d4bc +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-darwin-arm64.tar.gz: 75b8f0ff3a4e68147156be4161a49d4576f1be37a0b506473f8c482140c1e7f2 +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-amd64.tar.gz: 17aeb26c76820c22efa0e1838b0ab93e90cfedef43fbfc9a2f33f27eb9e5e070 +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-arm64.tar.gz: 9744bc34e7b8d82ca788b667bfb7155a39b4be9aef43bf9f10318b1372cea338 +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-linux-armv6.tar.gz: 0dda8dbeb2ff7455a044ec8e347f2fc6d655d2e99d281b3b95e88167031c673d +https://github.com/golangci/golangci-lint/releases/download/v1.51.1/golangci-lint-1.51.1-windows-amd64.zip: 722d7b87b9cdda0a3835d5030b3fc5385c2eba4c107f63f6391cfb2ac35f051d https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_arm64.tar.gz: 1f95e6561974f4766d8833438b646b06930563ca9867447ea03edb623d876c75 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_x86_64.tar.gz: 17ecad881a50e32f033da5a200c8417d37cae70f09e925645452937998aca506 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Linux_arm64.tar.gz: 8bf2a9b9e84498bfa239f2fe91b2d555642c87ab9d3f5d37f29e6e97116910a3 diff --git a/tools/tools.mk b/tools/tools.mk index e2a2180a8..346dbf946 100644 --- a/tools/tools.mk +++ b/tools/tools.mk @@ -102,7 +102,7 @@ retry:= endif # tool versions -GOLANGCI_LINT_VERSION=1.50.1 +GOLANGCI_LINT_VERSION=1.51.1 CHECKLOCKS_VERSION=release-20221026.0 NODE_VERSION=16.13.0 HUGO_VERSION=0.89.2