From 308aaa613c555695b97ef20ca7b1c9d77ec95bae Mon Sep 17 00:00:00 2001 From: N-o-Z Date: Tue, 7 Jan 2025 11:19:37 -0500 Subject: [PATCH] Upgrade to Golang 1.23 (#8452) * Upgrade to Golang 1.23 * Upgrade golangci-lint and fix * Fix MarshalInt64 * CR Fixes --- .github/workflows/codeql-analysis.yaml | 2 +- .github/workflows/compatibility-tests.yaml | 4 +-- .../workflows/docker-publish-exp-image.yaml | 2 +- .github/workflows/docker-publish.yaml | 2 +- .github/workflows/esti.yaml | 4 +-- .github/workflows/goreleaser.yaml | 2 +- .github/workflows/test.yaml | 4 +-- .golangci.yml | 2 +- Dockerfile | 4 +-- Makefile | 2 +- .../treeverse/jpebble/BlockParserSpec.scala | 2 +- esti/ops/docker-compose-dynamodb.yaml | 2 +- esti/ops/docker-compose-external-db.yaml | 2 +- esti/ops/docker-compose.yaml | 2 +- go.mod | 16 ++++++------ go.sum | 18 +++++-------- go.work | 4 +-- go.work.sum | 12 +++++++++ pkg/actions/lua/stdlib.go | 2 +- pkg/actions/service.go | 1 - pkg/api/controller.go | 10 ++++---- pkg/api/helpers/upload.go | 1 - pkg/block/s3/adapter.go | 8 +++--- pkg/catalog/catalog.go | 6 ++--- pkg/gateway/operations/getobject.go | 2 +- pkg/gateway/sig/v4_streaming_reader.go | 2 +- pkg/graveler/branch/protection_manager.go | 1 - pkg/graveler/graveler.go | 12 ++++----- pkg/ident/ident.go | 2 +- pkg/kv/cosmosdb/store.go | 2 +- pkg/kv/dynamodb/store.go | 2 +- pkg/loadtest/loader.go | 1 - pkg/local/posix_permissions.go | 2 +- pkg/metastore/glue/converter.go | 25 ++++++++++--------- pkg/metastore/glue/metastore_client.go | 2 +- pkg/metastore/hive/converter.go | 14 +++++------ webui/go.mod | 2 +- 37 files changed, 92 insertions(+), 91 deletions(-) diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index 8668dc7a08f..3156c4abc64 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -29,7 +29,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" - name: Generate code env: diff --git a/.github/workflows/compatibility-tests.yaml b/.github/workflows/compatibility-tests.yaml index 3a3181747f6..a51c25d0595 100644 --- a/.github/workflows/compatibility-tests.yaml +++ b/.github/workflows/compatibility-tests.yaml @@ -22,7 +22,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - uses: actions/setup-node@v4 @@ -78,7 +78,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - name: Retrieve generated code diff --git a/.github/workflows/docker-publish-exp-image.yaml b/.github/workflows/docker-publish-exp-image.yaml index 70d6c7b5bb0..e7a4b1fd8a3 100644 --- a/.github/workflows/docker-publish-exp-image.yaml +++ b/.github/workflows/docker-publish-exp-image.yaml @@ -37,7 +37,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - uses: bufbuild/buf-setup-action@v1.28.1 diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index fffe994aa8c..78065cb20bb 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -30,7 +30,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - uses: bufbuild/buf-setup-action@v1.28.1 diff --git a/.github/workflows/esti.yaml b/.github/workflows/esti.yaml index 010771b3ef2..95c53df92ec 100644 --- a/.github/workflows/esti.yaml +++ b/.github/workflows/esti.yaml @@ -53,7 +53,7 @@ jobs: if: steps.restore-cache.outputs.cache-hit != 'true' uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - name: Setup NodeJS @@ -201,7 +201,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" id: go - name: Generate uniquifying value diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml index ec315f45391..c1dbda518b5 100644 --- a/.github/workflows/goreleaser.yaml +++ b/.github/workflows/goreleaser.yaml @@ -28,7 +28,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fc92a34d3a1..371579c59ca 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" - uses: actions/setup-node@v4 with: node-version: "18.17.0" @@ -43,7 +43,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.22.6" + go-version: "1.23" - name: Run Go tests run: | mkdir ./webui/dist diff --git a/.golangci.yml b/.golangci.yml index 13073d27767..1431da02c29 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -23,7 +23,7 @@ linters: - ineffassign - misspell - nakedret - - exportloopref + - copyloopvar - staticcheck - stylecheck - typecheck diff --git a/Dockerfile b/Dockerfile index 9fde2b5bc5a..a2ea023c991 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,11 @@ ARG VERSION=dev ARG BUILD_REPO=golang -ARG BUILD_TAG=1.22.6-alpine3.20 +ARG BUILD_TAG=1.23-alpine ARG BUILD_PACKAGES="build-base ca-certificates" ARG IMAGE_REPO=alpine -ARG IMAGE_TAG=3.18 +ARG IMAGE_TAG=3.21 ARG IMAGE_PACKAGES=ca-certificates ARG ADD_PACKAGES="apk add -U --no-cache" diff --git a/Makefile b/Makefile index 89717338e2e..67224de8e11 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ OPENAPI_RUST_GENERATOR_IMAGE=openapitools/openapi-generator-cli:v7.5.0 OPENAPI_RUST_GENERATOR=$(DOCKER) run --user $(UID_GID) --rm -v $(shell pwd):/mnt $(OPENAPI_RUST_GENERATOR_IMAGE) PY_OPENAPI_GENERATOR=$(DOCKER) run -e PYTHON_POST_PROCESS_FILE="/mnt/clients/python/scripts/pydantic.sh" --user $(UID_GID) --rm -v $(shell pwd):/mnt $(OPENAPI_GENERATOR_IMAGE) -GOLANGCI_LINT_VERSION=v1.58.1 +GOLANGCI_LINT_VERSION=v1.63.1 BUF_CLI_VERSION=v1.28.1 ifndef PACKAGE_VERSION diff --git a/clients/spark/src/test/scala/io/treeverse/jpebble/BlockParserSpec.scala b/clients/spark/src/test/scala/io/treeverse/jpebble/BlockParserSpec.scala index 74b08a732d9..cacbe92c980 100644 --- a/clients/spark/src/test/scala/io/treeverse/jpebble/BlockParserSpec.scala +++ b/clients/spark/src/test/scala/io/treeverse/jpebble/BlockParserSpec.scala @@ -304,7 +304,7 @@ class CountedIteratorSpec extends AnyFunSpec with Matchers { class GolangContainerSpec extends AnyFunSpec with ForAllTestContainer { override val container: GenericContainer = GenericContainer( - "golang:1.22.6-alpine", + "golang:1.23-alpine", classpathResourceMapping = Seq( FileSystemBind("parser-test/sst_files_generator.go", "/local/sst_files_generator.go", diff --git a/esti/ops/docker-compose-dynamodb.yaml b/esti/ops/docker-compose-dynamodb.yaml index b78ca187508..ba2d2eb16b7 100644 --- a/esti/ops/docker-compose-dynamodb.yaml +++ b/esti/ops/docker-compose-dynamodb.yaml @@ -38,7 +38,7 @@ services: - "6432:8000" esti: - image: "golang:1.22.6-alpine3.20" + image: "golang:1.23-alpine" links: - lakefs:s3.local.lakefs.io - lakefs:testmultipartupload.s3.local.lakefs.io diff --git a/esti/ops/docker-compose-external-db.yaml b/esti/ops/docker-compose-external-db.yaml index 9624c03abcf..2c6fa82d4b8 100644 --- a/esti/ops/docker-compose-external-db.yaml +++ b/esti/ops/docker-compose-external-db.yaml @@ -33,7 +33,7 @@ services: - "host.docker.internal:host-gateway" esti: - image: "golang:1.22.6-alpine3.20" + image: "golang:1.23-alpine" links: - lakefs:s3.local.lakefs.io - lakefs:testmultipartupload.s3.local.lakefs.io diff --git a/esti/ops/docker-compose.yaml b/esti/ops/docker-compose.yaml index f496d617047..960b12ea628 100644 --- a/esti/ops/docker-compose.yaml +++ b/esti/ops/docker-compose.yaml @@ -42,7 +42,7 @@ services: POSTGRES_PASSWORD: lakefs esti: - image: "golang:1.22.6-alpine3.20" + image: "golang:1.23-alpine" links: - lakefs:s3.local.lakefs.io - lakefs:testmultipartupload.s3.local.lakefs.io diff --git a/go.mod b/go.mod index a57ddd9bf2a..7f33e9cad25 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/treeverse/lakefs -go 1.22 - -toolchain go1.22.0 +go 1.23 require ( cloud.google.com/go v0.111.0 // indirect @@ -47,9 +45,9 @@ require ( github.com/vbauerster/mpb/v5 v5.4.0 github.com/xitongsys/parquet-go v1.6.2 github.com/xitongsys/parquet-go-source v0.0.0-20230607234618-40034c8066df - golang.org/x/crypto v0.27.0 + golang.org/x/crypto v0.31.0 golang.org/x/oauth2 v0.15.0 - golang.org/x/term v0.24.0 + golang.org/x/term v0.27.0 google.golang.org/api v0.152.0 google.golang.org/protobuf v1.33.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0 @@ -58,7 +56,7 @@ require ( require ( cloud.google.com/go/compute v1.23.3 // indirect - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.10.0 ) require ( @@ -248,9 +246,9 @@ require ( go.uber.org/atomic v1.11.0 golang.org/x/exp v0.0.0-20231127185646-65229373498e golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.29.0 - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/net v0.33.0 + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/appengine v1.6.8 // indirect diff --git a/go.sum b/go.sum index a052a4c21ea..b50976b48da 100644 --- a/go.sum +++ b/go.sum @@ -1172,8 +1172,7 @@ golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1281,8 +1280,7 @@ golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1317,8 +1315,7 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1414,15 +1411,13 @@ 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.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1434,8 +1429,7 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/go.work b/go.work index 4c2f5141f15..97e8909c11b 100644 --- a/go.work +++ b/go.work @@ -1,6 +1,6 @@ -go 1.22 +go 1.23 use ( . ./webui -) \ No newline at end of file +) diff --git a/go.work.sum b/go.work.sum index 15d465b406b..b5e838eb1bf 100644 --- a/go.work.sum +++ b/go.work.sum @@ -603,11 +603,23 @@ go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/image v0.0.0-20210216034530-4410531fe030 h1:lP9pYkih3DUSC641giIXa2XqfTIbbbRr0w2EOTA7wHA= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2 h1:IRJeR9r1pYWsHKTRe/IInb7lYvbBVIqOgsX/u0mbOWY= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc= gonum.org/v1/plot v0.9.0 h1:3sEo36Uopv1/SA/dMFFaxXoL5XyikJ9Sf2Vll/k6+2E= google.golang.org/genproto/googleapis/bytestream v0.0.0-20231120223509-83a465c0220f h1:hL+1ptbhFoeL1HcROQ8OGXaqH0jYRRibgWQWco0/Ugc= diff --git a/pkg/actions/lua/stdlib.go b/pkg/actions/lua/stdlib.go index ae929c3f93a..55f7f3c7717 100644 --- a/pkg/actions/lua/stdlib.go +++ b/pkg/actions/lua/stdlib.go @@ -151,7 +151,7 @@ func getBaseLibrary(output io.StringWriter) []glua.RegistryFunction { var stats runtime.MemStats runtime.ReadMemStats(&stats) l.PushNumber(float64(stats.HeapAlloc >> 10)) - l.PushInteger(int(stats.HeapAlloc & 0x3ff)) + l.PushInteger(int(stats.HeapAlloc & 0x3ff)) //nolint:gosec return 2 default: l.PushInteger(-1) diff --git a/pkg/actions/service.go b/pkg/actions/service.go index 316668fc6bf..93afa894fa6 100644 --- a/pkg/actions/service.go +++ b/pkg/actions/service.go @@ -343,7 +343,6 @@ func (s *StoreService) allocateTasks(runID string, actions []*Action) ([][]*Task func (s *StoreService) runTasks(ctx context.Context, record graveler.HookRecord, tasks [][]*Task) error { var g multierror.Group for _, actionTasks := range tasks { - actionTasks := actionTasks // pin g.Go(func() error { var actionErr error for _, task := range actionTasks { diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 28b71d15a3b..076f18c73ab 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -195,7 +195,7 @@ func (c *Controller) CreatePresignMultipartUpload(w http.ResponseWriter, r *http // check valid number of parts if params.Parts != nil { - if *params.Parts < 0 || int32(*params.Parts) > manager.MaxUploadParts { + if *params.Parts < 0 || int32(*params.Parts) > manager.MaxUploadParts { //nolint:gosec writeError(w, r, http.StatusBadRequest, fmt.Sprintf("parts can be between 0 and %d", manager.MaxUploadParts)) return } @@ -2339,11 +2339,11 @@ func (c *Controller) SetGCRules(w http.ResponseWriter, r *http.Request, body api } ctx := r.Context() rules := &graveler.GarbageCollectionRules{ - DefaultRetentionDays: int32(body.DefaultRetentionDays), + DefaultRetentionDays: int32(body.DefaultRetentionDays), //nolint:gosec BranchRetentionDays: make(map[string]int32), } for _, rule := range body.Branches { - rules.BranchRetentionDays[rule.BranchId] = int32(rule.RetentionDays) + rules.BranchRetentionDays[rule.BranchId] = int32(rule.RetentionDays) //nolint:gosec } err := c.Catalog.SetGarbageCollectionRules(ctx, repository, rules) if c.handleAPIError(ctx, w, r, err) { @@ -3039,7 +3039,7 @@ func (c *Controller) CreateCommitRecord(w http.ResponseWriter, r *http.Request, writeError(w, r, http.StatusUnauthorized, "missing user") return } - err = c.Catalog.CreateCommitRecord(ctx, repository, body.CommitId, body.Version, body.Committer, body.Message, body.MetarangeId, body.CreationDate, body.Parents, body.Metadata.AdditionalProperties, int(body.Generation), graveler.WithForce(swag.BoolValue(body.Force))) + err = c.Catalog.CreateCommitRecord(ctx, repository, body.CommitId, body.Version, body.Committer, body.Message, body.MetarangeId, body.CreationDate, body.Parents, body.Metadata.AdditionalProperties, int32(body.Generation), graveler.WithForce(swag.BoolValue(body.Force))) //nolint:gosec if c.handleAPIError(ctx, w, r, err) { return } @@ -5219,7 +5219,7 @@ func (c *Controller) PostStatsEvents(w http.ResponseWriter, r *http.Request, bod UserID: user.Username, Client: client, } - c.Collector.CollectEvents(ev, uint64(statsEv.Count)) + c.Collector.CollectEvents(ev, uint64(statsEv.Count)) //nolint:gosec c.Logger.WithContext(ctx).WithFields(logging.Fields{ "class": ev.Class, diff --git a/pkg/api/helpers/upload.go b/pkg/api/helpers/upload.go index 27e09027a6f..3374f16f1df 100644 --- a/pkg/api/helpers/upload.go +++ b/pkg/api/helpers/upload.go @@ -191,7 +191,6 @@ func (u *presignUpload) uploadMultipart(ctx context.Context) (*apigen.ObjectStat g.SetLimit(u.uploader.Concurrency) for i := 0; i < u.numParts; i++ { - i := i // pinning g.Go(func() error { etag, err := u.uploadPart(grpCtx, parts[i].Reader, parts[i].URL) if err != nil { diff --git a/pkg/block/s3/adapter.go b/pkg/block/s3/adapter.go index 254d8064b28..2f8ff3060c0 100644 --- a/pkg/block/s3/adapter.go +++ b/pkg/block/s3/adapter.go @@ -316,7 +316,7 @@ func (a *Adapter) UploadPart(ctx context.Context, obj block.ObjectPointer, sizeB uploadPartInput := &s3.UploadPartInput{ Bucket: aws.String(bucket), Key: aws.String(key), - PartNumber: aws.Int32(int32(partNumber)), + PartNumber: aws.Int32(int32(partNumber)), //nolint:gosec UploadId: aws.String(uploadID), Body: reader, ContentLength: aws.Int64(sizeBytes), @@ -481,7 +481,7 @@ func (a *Adapter) GetPresignUploadPartURL(ctx context.Context, obj block.ObjectP Bucket: aws.String(bucket), Key: aws.String(key), UploadId: aws.String(uploadID), - PartNumber: aws.Int32(int32(partNumber)), + PartNumber: aws.Int32(int32(partNumber)), //nolint:gosec } uploadPart, err := presigner.PresignUploadPart(ctx, uploadInput) if err != nil { @@ -609,7 +609,7 @@ func (a *Adapter) copyPart(ctx context.Context, sourceObj, destinationObj block. uploadPartCopyObject := s3.UploadPartCopyInput{ Bucket: aws.String(bucket), Key: aws.String(key), - PartNumber: aws.Int32(int32(partNumber)), + PartNumber: aws.Int32(int32(partNumber)), //nolint:gosec UploadId: aws.String(uploadID), CopySource: aws.String(fmt.Sprintf("%s/%s", srcKey.GetStorageNamespace(), srcKey.GetKey())), } @@ -752,7 +752,7 @@ func convertFromBlockMultipartUploadCompletion(multipartList *block.MultipartUpl for _, p := range multipartList.Part { parts = append(parts, types.CompletedPart{ ETag: aws.String(p.ETag), - PartNumber: aws.Int32(int32(p.PartNumber)), + PartNumber: aws.Int32(int32(p.PartNumber)), //nolint:gosec }) } return &types.CompletedMultipartUpload{Parts: parts} diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index ee405570c8d..79df3ad50dc 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -1297,7 +1297,7 @@ func (c *Catalog) Commit(ctx context.Context, repositoryID, branch, message, com return catalogCommitLog, nil } -func (c *Catalog) CreateCommitRecord(ctx context.Context, repositoryID string, commitID string, version int, committer string, message string, metaRangeID string, creationDate int64, parents []string, metadata map[string]string, generation int, opts ...graveler.SetOptionsFunc) error { +func (c *Catalog) CreateCommitRecord(ctx context.Context, repositoryID string, commitID string, version int, committer string, message string, metaRangeID string, creationDate int64, parents []string, metadata map[string]string, generation int32, opts ...graveler.SetOptionsFunc) error { repository, err := c.getRepository(ctx, repositoryID) if err != nil { return err @@ -1307,14 +1307,14 @@ func (c *Catalog) CreateCommitRecord(ctx context.Context, repositoryID string, c commitParents[i] = graveler.CommitID(parent) } commit := graveler.Commit{ - Version: graveler.CommitVersion(version), + Version: graveler.CommitVersion(version), //nolint:gosec Committer: committer, Message: message, MetaRangeID: graveler.MetaRangeID(metaRangeID), CreationDate: time.Unix(creationDate, 0).UTC(), Parents: commitParents, Metadata: metadata, - Generation: graveler.CommitGeneration(generation), + Generation: graveler.CommitGeneration(generation), //nolint:gosec } return c.Store.CreateCommitRecord(ctx, repository, graveler.CommitID(commitID), commit, opts...) } diff --git a/pkg/gateway/operations/getobject.go b/pkg/gateway/operations/getobject.go index 2b27f73aaa9..22f054bccfc 100644 --- a/pkg/gateway/operations/getobject.go +++ b/pkg/gateway/operations/getobject.go @@ -221,7 +221,7 @@ func handleListParts(w http.ResponseWriter, req *http.Request, o *PathOperation) parts := make([]serde.MultipartUploadPart, len(partsResp.Parts)) for i, part := range partsResp.Parts { parts[i] = serde.MultipartUploadPart{ - PartNumber: int32(part.PartNumber), + PartNumber: int32(part.PartNumber), //nolint:gosec ETag: part.ETag, LastModified: serde.Timestamp(part.LastModified), Size: part.Size, diff --git a/pkg/gateway/sig/v4_streaming_reader.go b/pkg/gateway/sig/v4_streaming_reader.go index bb133d9c7ef..21e6aa50c24 100644 --- a/pkg/gateway/sig/v4_streaming_reader.go +++ b/pkg/gateway/sig/v4_streaming_reader.go @@ -226,7 +226,7 @@ func (cr *s3ChunkedReader) Read(buf []byte) (n int, err error) { n += n0 buf = buf[n0:] // Update bytes to be read of the current chunk before verifying chunk's signature. - cr.n -= uint64(n0) + cr.n -= uint64(n0) //nolint:gosec // If we're at the end of a chunk. if cr.n == 0 { diff --git a/pkg/graveler/branch/protection_manager.go b/pkg/graveler/branch/protection_manager.go index ac0cd04ddd5..13ecbc03cd6 100644 --- a/pkg/graveler/branch/protection_manager.go +++ b/pkg/graveler/branch/protection_manager.go @@ -51,7 +51,6 @@ func (m *ProtectionManager) IsBlocked(ctx context.Context, repository *graveler. return false, err } for pattern, blockedActions := range rules.BranchPatternToBlockedActions { - pattern := pattern matcher, err := m.matchers.GetOrSet(pattern, func() (v interface{}, err error) { return glob.Compile(pattern) }) diff --git a/pkg/graveler/graveler.go b/pkg/graveler/graveler.go index 20d5317c897..6cfac69f9ce 100644 --- a/pkg/graveler/graveler.go +++ b/pkg/graveler/graveler.go @@ -437,9 +437,9 @@ func (cp CommitParents) AsStringSlice() []string { const FirstCommitMsg = "Repository created" // CommitVersion used to track changes in Commit schema. Each version is change that a constant describes. -type CommitVersion int +type CommitVersion int32 -type CommitGeneration int64 +type CommitGeneration int32 const ( CommitVersionInitial CommitVersion = iota @@ -2170,14 +2170,14 @@ func (g *Graveler) Commit(ctx context.Context, repository *RepositoryRecord, bra } var branchMetaRangeID MetaRangeID - var parentGeneration int + var parentGeneration int32 if branch.CommitID != "" { branchCommit, err := g.RefManager.GetCommit(ctx, repository, branch.CommitID) if err != nil { return nil, fmt.Errorf("get commit: %w", err) } branchMetaRangeID = branchCommit.MetaRangeID - parentGeneration = int(branchCommit.Generation) + parentGeneration = int32(branchCommit.Generation) } commit.Generation = CommitGeneration(parentGeneration + 1) if params.SourceMetaRange != nil { @@ -2536,7 +2536,7 @@ func (g *Graveler) resetKey(ctx context.Context, repository *RepositoryRecord, b return g.StagingManager.Set(ctx, st, key, committed, false) // entry not committed and changed in staging area => override with tombstone // If not committed and staging == tombstone => ignore - } else if !isCommitted && uncommittedValue != nil { + } else if uncommittedValue != nil { return g.deleteAndNotify(ctx, repository.RepositoryID, BranchRecord{branchID, branch}, key, false) } @@ -3688,7 +3688,7 @@ func (c *commitValueIterator) setValue() bool { } commit := c.src.Value() data, err := proto.Marshal(&CommitData{ - Version: int32(commit.Version), + Version: int32(commit.Version), //nolint:gosec Id: string(commit.CommitID), Committer: commit.Committer, Message: commit.Message, diff --git a/pkg/ident/ident.go b/pkg/ident/ident.go index ec3d86cbf6f..fc674405053 100644 --- a/pkg/ident/ident.go +++ b/pkg/ident/ident.go @@ -61,7 +61,7 @@ func MarshalInt64(h hash.Hash, v int64) { marshalType(h, AddressTypeInt64) _, _ = h.Write([]byte{int64Bytes}) bytes := make([]byte, int64Bytes) - binary.BigEndian.PutUint64(bytes, uint64(v)) + binary.BigEndian.PutUint64(bytes, uint64(v)) //nolint:gosec _, _ = h.Write(bytes) } diff --git a/pkg/kv/cosmosdb/store.go b/pkg/kv/cosmosdb/store.go index 69292c4952c..697385cc767 100644 --- a/pkg/kv/cosmosdb/store.go +++ b/pkg/kv/cosmosdb/store.go @@ -517,7 +517,7 @@ func (e *EntriesIterator) runQuery(includeStartKey bool) error { pk := azcosmos.NewPartitionKeyString(encoding.EncodeToString(e.partitionKey)) e.queryPager = e.store.containerClient.NewQueryItemsPager(query, pk, &azcosmos.QueryOptions{ ConsistencyLevel: e.store.consistencyLevel.ToPtr(), - PageSizeHint: int32(e.batchSize), + PageSizeHint: int32(e.batchSize), //nolint:gosec QueryParameters: []azcosmos.QueryParameter{{ Name: "@start", Value: encoding.EncodeToString(e.startKey), diff --git a/pkg/kv/dynamodb/store.go b/pkg/kv/dynamodb/store.go index ebbc58a7611..a5808fafee5 100644 --- a/pkg/kv/dynamodb/store.go +++ b/pkg/kv/dynamodb/store.go @@ -521,7 +521,7 @@ func (e *EntriesIterator) runQuery(limit int) { ReturnConsumedCapacity: types.ReturnConsumedCapacityTotal, } - queryInput.Limit = aws.Int32(int32(limit)) + queryInput.Limit = aws.Int32(int32(limit)) //nolint:gosec e.store.logger. WithField("partition_key", e.partitionKey). WithField("limit", limit). diff --git a/pkg/loadtest/loader.go b/pkg/loadtest/loader.go index 8a4bee7a75d..cdb602e0f47 100644 --- a/pkg/loadtest/loader.go +++ b/pkg/loadtest/loader.go @@ -216,7 +216,6 @@ func (t *Loader) streamRequests(in <-chan vegeta.Target) <-chan error { go func() { defer close(errs) for tgt := range in { - tgt := tgt // pin err := encoder.Encode(&tgt) if err != nil { errs <- err diff --git a/pkg/local/posix_permissions.go b/pkg/local/posix_permissions.go index df2cf03fe1f..f65210d247d 100644 --- a/pkg/local/posix_permissions.go +++ b/pkg/local/posix_permissions.go @@ -54,7 +54,7 @@ func GetDefaultPermissions(isDir bool) POSIXPermissions { } return POSIXPermissions{ POSIXOwnership: *defaultOwnership, - Mode: os.FileMode(mode), + Mode: os.FileMode(mode), //nolint:gosec } } diff --git a/pkg/metastore/glue/converter.go b/pkg/metastore/glue/converter.go index 878c2439665..31e8e9efc19 100644 --- a/pkg/metastore/glue/converter.go +++ b/pkg/metastore/glue/converter.go @@ -139,7 +139,7 @@ func sortColumnsLocalToGlue(columns []*metastore.Order) []types.Order { for _, column := range columns { res = append(res, types.Order{ Column: aws.String(column.Col), - SortOrder: int32(column.Order), + SortOrder: int32(column.Order), //nolint:gosec }) } return res @@ -190,14 +190,15 @@ func TableLocalToGlue(table *metastore.Table) *types.TableInput { sd := SDLocalToGlue(table.Sd) targetTable, _ := table.AWSTargetTable.(*types.TableIdentifier) ht := &types.TableInput{ - Description: table.AWSDescription, - LastAccessTime: localToAWSTime(table.LastAccessTime), // TODO(Guys): check if this OK - LastAnalyzedTime: table.AWSLastAnalyzedTime, - Name: aws.String(table.TableName), - Owner: aws.String(table.Owner), - Parameters: table.Parameters, - PartitionKeys: columnsLocalToGlue(table.PartitionKeys), - Retention: int32(table.Retention), // TODO(Guys): check if this OK + Description: table.AWSDescription, + LastAccessTime: localToAWSTime(table.LastAccessTime), // TODO(Guys): check if this OK + LastAnalyzedTime: table.AWSLastAnalyzedTime, + Name: aws.String(table.TableName), + Owner: aws.String(table.Owner), + Parameters: table.Parameters, + PartitionKeys: columnsLocalToGlue(table.PartitionKeys), + // TODO(Guys): check if this OK + Retention: int32(table.Retention), ////nolint:gosec StorageDescriptor: sd, TableType: aws.String(table.TableType), TargetTable: targetTable, @@ -210,8 +211,8 @@ func TableLocalToGlue(table *metastore.Table) *types.TableInput { func PartitionLocalToGlue(partition *metastore.Partition) *types.PartitionInput { sd := SDLocalToGlue(partition.Sd) ht := &types.PartitionInput{ - // IsRegisteredWithLakeFormation: partition.AWSIsRegisteredWithLakeFormation, - LastAccessTime: localToAWSTime(int64(partition.LastAccessTime)), // TODO(Guys): check if this OK + // TODO(Guys): check if this OK + LastAccessTime: localToAWSTime(int64(partition.LastAccessTime)), //nolint:gosec LastAnalyzedTime: partition.AWSLastAnalyzedTime, Parameters: partition.Parameters, StorageDescriptor: sd, @@ -239,7 +240,7 @@ func SDLocalToGlue(sd *metastore.StorageDescriptor) *types.StorageDescriptor { Compressed: sd.Compressed, InputFormat: aws.String(sd.InputFormat), Location: aws.String(sd.Location), - NumberOfBuckets: int32(sd.NumBuckets), + NumberOfBuckets: int32(sd.NumBuckets), //nolint:gosec OutputFormat: aws.String(sd.OutputFormat), Parameters: sd.Parameters, SchemaReference: schemaRef, diff --git a/pkg/metastore/glue/metastore_client.go b/pkg/metastore/glue/metastore_client.go index dbc653752b6..15c0b513eee 100644 --- a/pkg/metastore/glue/metastore_client.go +++ b/pkg/metastore/glue/metastore_client.go @@ -65,7 +65,7 @@ func (g *MSClient) GetDatabase(ctx context.Context, name string) (*metastore.Dat func (g *MSClient) getDatabaseFromGlue(ctx context.Context, token *string, parts int) (*glue.GetDatabasesOutput, error) { return g.client.GetDatabases(ctx, &glue.GetDatabasesInput{ CatalogId: aws.String(g.catalogID), - MaxResults: aws.Int32(int32(parts)), + MaxResults: aws.Int32(int32(parts)), //nolint:gosec NextToken: token, }) } diff --git a/pkg/metastore/hive/converter.go b/pkg/metastore/hive/converter.go index e9d262d9a35..2f8c49208e2 100644 --- a/pkg/metastore/hive/converter.go +++ b/pkg/metastore/hive/converter.go @@ -98,7 +98,7 @@ func sortColumnsLocalToHive(columns []*metastore.Order) []*hive_metastore.Order for i, column := range columns { res[i] = &hive_metastore.Order{ Col: column.Col, - Order: int32(column.Order), + Order: int32(column.Order), //nolint:gosec } } return res @@ -124,9 +124,9 @@ func TableLocalToHive(table *metastore.Table) *hive_metastore.Table { DbName: table.DBName, TableName: table.TableName, Owner: table.Owner, - CreateTime: int32(table.CreateTime), - LastAccessTime: int32(table.LastAccessTime), - Retention: int32(table.Retention), + CreateTime: int32(table.CreateTime), //nolint:gosec + LastAccessTime: int32(table.LastAccessTime), //nolint:gosec + Retention: int32(table.Retention), //nolint:gosec Sd: sd, PartitionKeys: columnsLocalToHive(table.PartitionKeys), @@ -192,8 +192,8 @@ func PartitionLocalToHive(partition *metastore.Partition) *hive_metastore.Partit Values: partition.Values, DbName: partition.DBName, TableName: partition.TableName, - CreateTime: int32(partition.CreateTime), - LastAccessTime: int32(partition.LastAccessTime), + CreateTime: int32(partition.CreateTime), //nolint:gosec + LastAccessTime: int32(partition.LastAccessTime), //nolint:gosec Sd: sd, Parameters: partition.Parameters, Privileges: privileges, @@ -211,7 +211,7 @@ func SDLocalToHive(sd *metastore.StorageDescriptor) *hive_metastore.StorageDescr InputFormat: sd.InputFormat, OutputFormat: sd.OutputFormat, Compressed: sd.Compressed, - NumBuckets: int32(sd.NumBuckets), + NumBuckets: int32(sd.NumBuckets), //nolint:gosec SerdeInfo: serDeLocalToHive(sd.SerdeInfo), BucketCols: sd.BucketCols, SortCols: sortColumnsLocalToHive(sd.SortCols), diff --git a/webui/go.mod b/webui/go.mod index c91ab6be43c..fdb6d412fd4 100644 --- a/webui/go.mod +++ b/webui/go.mod @@ -1,5 +1,5 @@ module github.com/treeverse/lakefs/webui -go 1.22 +go 1.23 // This module uses the go.work file to get all package dependencies from lakefs \ No newline at end of file