From 25cb9200a83cc0c8699c7ad5f361a3a9c5122f36 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:03:03 +0000 Subject: [PATCH] chore(lint): Upgrade golanglint from v2.7.2 to v2.8.0 and fix lint issues" --- .bingo/.gitignore | 1 + .bingo/README.md | 11 ++++----- .bingo/Variables.mk | 22 +++++++++++------ .bingo/golangci-lint.mod | 2 +- .bingo/golangci-lint.sum | 34 ++++++++++++++++++++++++++ .bingo/variables.env | 4 +-- alpha/declcfg/model_to_declcfg.go | 2 +- alpha/model/model.go | 2 +- alpha/template/semver/semver.go | 6 ++--- alpha/template/semver/semver_test.go | 2 +- pkg/cache/pkgs.go | 2 +- pkg/lib/bundle/validate.go | 2 +- pkg/lib/registry/registry.go | 2 +- pkg/lib/validation/bundle_test.go | 4 +-- pkg/registry/bundle_test.go | 2 +- pkg/registry/conversion.go | 2 +- pkg/registry/populator_test.go | 20 +++++++-------- pkg/registry/registry_to_model_test.go | 7 +++--- pkg/sqlite/migrations/migrations.go | 4 +-- pkg/sqlite/query.go | 2 +- 20 files changed, 87 insertions(+), 46 deletions(-) diff --git a/.bingo/.gitignore b/.bingo/.gitignore index 9efccf683..4428593c3 100644 --- a/.bingo/.gitignore +++ b/.bingo/.gitignore @@ -11,3 +11,4 @@ !variables.env *tmp.mod +*tmp.sum diff --git a/.bingo/README.md b/.bingo/README.md index 7a5c2d4f6..c812e3a6c 100644 --- a/.bingo/README.md +++ b/.bingo/README.md @@ -1,14 +1,13 @@ # Project Development Dependencies. -This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo. +This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by . * Run `bingo get` to install all tools having each own module file in this directory. -* Run `bingo get ` to install that have own module file in this directory. -* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $() variable where is the .bingo/.mod. +* Run `bingo get ` to install `` that have own module file in this directory. +* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use `\$()` variable where `` is the .bingo/`.mod`. * For shell: Run `source .bingo/variables.env` to source all environment variable for each tool. -* For go: Import `.bingo/variables.go` to for variable names. -* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies. +* See or -h on how to add, remove or change binaries dependencies. ## Requirements -* Go 1.14+ +* Go 1.24.x or 1.25.x diff --git a/.bingo/Variables.mk b/.bingo/Variables.mk index 623d5d44e..aef49c60c 100644 --- a/.bingo/Variables.mk +++ b/.bingo/Variables.mk @@ -1,10 +1,16 @@ -# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.10. DO NOT EDIT. # All tools are designed to be build inside $GOBIN. BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST))) GOPATH ?= $(shell go env GOPATH) GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin GO ?= $(shell which go) +# Ensure bingo-managed tools are always built for the host platform, +# even when GOOS/GOARCH are set for cross-compilation of other targets. +GOHOSTOS ?= $(shell $(GO) env GOHOSTOS) +GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH) +GOHOSTARM ?= $(shell $(GO) env GOHOSTARM) + # Below generated variables ensure that every time a tool under each variable is invoked, the correct version # will be used; reinstalling only if needed. # For example for bingo variable: @@ -21,29 +27,29 @@ BINGO := $(GOBIN)/bingo-v0.9.0 $(BINGO): $(BINGO_DIR)/bingo.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. @echo "(re)installing $(GOBIN)/bingo-v0.9.0" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo" + @cd $(BINGO_DIR) && GOWORK=off GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) GOARM=$(GOHOSTARM) $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.9.0 "github.com/bwplotka/bingo" GINKGO := $(GOBIN)/ginkgo-v2.23.4 $(GINKGO): $(BINGO_DIR)/ginkgo.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. @echo "(re)installing $(GOBIN)/ginkgo-v2.23.4" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v2.23.4 "github.com/onsi/ginkgo/v2/ginkgo" + @cd $(BINGO_DIR) && GOWORK=off GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) GOARM=$(GOHOSTARM) $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v2.23.4 "github.com/onsi/ginkgo/v2/ginkgo" -GOLANGCI_LINT := $(GOBIN)/golangci-lint-v2.7.2 +GOLANGCI_LINT := $(GOBIN)/golangci-lint-v2.8.0 $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. - @echo "(re)installing $(GOBIN)/golangci-lint-v2.7.2" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v2.7.2 "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" + @echo "(re)installing $(GOBIN)/golangci-lint-v2.8.0" + @cd $(BINGO_DIR) && GOWORK=off GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) GOARM=$(GOHOSTARM) $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v2.8.0 "github.com/golangci/golangci-lint/v2/cmd/golangci-lint" GORELEASER := $(GOBIN)/goreleaser-v2.12.7 $(GORELEASER): $(BINGO_DIR)/goreleaser.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. @echo "(re)installing $(GOBIN)/goreleaser-v2.12.7" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v2.12.7 "github.com/goreleaser/goreleaser/v2" + @cd $(BINGO_DIR) && GOWORK=off GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) GOARM=$(GOHOSTARM) $(GO) build -mod=mod -modfile=goreleaser.mod -o=$(GOBIN)/goreleaser-v2.12.7 "github.com/goreleaser/goreleaser/v2" PROTOC_GEN_GO_GRPC := $(GOBIN)/protoc-gen-go-grpc-v1.3.0 $(PROTOC_GEN_GO_GRPC): $(BINGO_DIR)/protoc-gen-go-grpc.mod @# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies. @echo "(re)installing $(GOBIN)/protoc-gen-go-grpc-v1.3.0" - @cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=protoc-gen-go-grpc.mod -o=$(GOBIN)/protoc-gen-go-grpc-v1.3.0 "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + @cd $(BINGO_DIR) && GOWORK=off GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) GOARM=$(GOHOSTARM) $(GO) build -mod=mod -modfile=protoc-gen-go-grpc.mod -o=$(GOBIN)/protoc-gen-go-grpc-v1.3.0 "google.golang.org/grpc/cmd/protoc-gen-go-grpc" diff --git a/.bingo/golangci-lint.mod b/.bingo/golangci-lint.mod index eaee3369b..ea27663cb 100644 --- a/.bingo/golangci-lint.mod +++ b/.bingo/golangci-lint.mod @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT go 1.25.3 -require github.com/golangci/golangci-lint/v2 v2.7.2 // cmd/golangci-lint +require github.com/golangci/golangci-lint/v2 v2.8.0 // cmd/golangci-lint diff --git a/.bingo/golangci-lint.sum b/.bingo/golangci-lint.sum index e07a97b92..17ea8e625 100644 --- a/.bingo/golangci-lint.sum +++ b/.bingo/golangci-lint.sum @@ -36,6 +36,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= codeberg.org/chavacava/garif v0.2.0 h1:F0tVjhYbuOCnvNcU3YSpO6b3Waw6Bimy4K0mM8y6MfY= codeberg.org/chavacava/garif v0.2.0/go.mod h1:P2BPbVbT4QcvLZrORc2T29szK3xEOlnl0GiPTJmEqBQ= +codeberg.org/polyfloyd/go-errorlint v1.9.0 h1:VkdEEmA1VBpH6ecQoMR4LdphVI3fA4RrCh2an7YmodI= +codeberg.org/polyfloyd/go-errorlint v1.9.0/go.mod h1:GPRRu2LzVijNn4YkrZYJfatQIdS+TrcK8rL5Xs24qw8= dev.gaijin.team/go/exhaustruct/v4 v4.0.0 h1:873r7aNneqoBB3IaFIzhvt2RFYTuHgmMjoKfwODoI1Y= dev.gaijin.team/go/exhaustruct/v4 v4.0.0/go.mod h1:aZ/k2o4Y05aMJtiux15x8iXaumE88YdiB0Ai4fXOzPI= dev.gaijin.team/go/golib v0.6.0 h1:v6nnznFTs4bppib/NyU1PQxobwDHwCXXl15P7DV5Zgo= @@ -58,6 +60,8 @@ github.com/Antonboom/testifylint v1.6.4/go.mod h1:YO33FROXX2OoUfwjz8g+gUxQXio5i9 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= +github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.1.1 h1:eHfopDqXRwAi+YmCUas75ZE0+hoBHJ2GQNLYRSxao4g= github.com/Djarvur/go-err113 v0.1.1/go.mod h1:IaWJdYFLg76t2ihfflPZnM1LIQszWOsFDh2hhhAVF6k= @@ -65,10 +69,14 @@ github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1 github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/MirrexOne/unqueryvet v1.3.0 h1:5slWSomgqpYU4zFuZ3NNOfOUxVPlXFDBPAVasZOGlAY= github.com/MirrexOne/unqueryvet v1.3.0/go.mod h1:IWwCwMQlSWjAIteW0t+28Q5vouyktfujzYznSIWiuOg= +github.com/MirrexOne/unqueryvet v1.4.0 h1:6KAkqqW2KUnkl9Z0VuTphC3IXRPoFqEkJEtyxxHj5eQ= +github.com/MirrexOne/unqueryvet v1.4.0/go.mod h1:IWwCwMQlSWjAIteW0t+28Q5vouyktfujzYznSIWiuOg= github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4= github.com/OpenPeeDeeP/depguard/v2 v2.2.1/go.mod h1:q4DKzC4UcVaAvcfd41CZh0PWpGgzrVxUYBlgKNGquUo= github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw= github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA= +github.com/alecthomas/chroma/v2 v2.21.1 h1:FaSDrp6N+3pphkNKU6HPCiYLgm8dbe5UXIXcoBhZSWA= +github.com/alecthomas/chroma/v2 v2.21.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o= github.com/alecthomas/go-check-sumtype v0.3.1 h1:u9aUvbGINJxLVXiFvHUlPEaD7VDULsrxJb4Aq31NLkU= github.com/alecthomas/go-check-sumtype v0.3.1/go.mod h1:A8TSiN3UPRw3laIgWEUOHHLPa6/r9MtoigdlP5h3K/E= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -80,6 +88,8 @@ github.com/alexkohler/nakedret/v2 v2.0.6 h1:ME3Qef1/KIKr3kWX3nti3hhgNxw6aqN5pZmQ github.com/alexkohler/nakedret/v2 v2.0.6/go.mod h1:l3RKju/IzOMQHmsEvXwkqMDzHHvurNQfAgE1eVmT40Q= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= +github.com/alexkohler/prealloc v1.0.1 h1:A9P1haqowqUxWvU9nk6tQ7YktXIHf+LQM9wPRhuteEE= +github.com/alexkohler/prealloc v1.0.1/go.mod h1:fT39Jge3bQrfA7nPMDngUfvUbQGQeJyGQnR+913SCig= github.com/alfatraining/structtag v1.0.0 h1:2qmcUqNcCoyVJ0up879K614L9PazjBSFruTB0GOFjCc= github.com/alfatraining/structtag v1.0.0/go.mod h1:p3Xi5SwzTi+Ryj64DqjLWz7XurHxbGsq6y3ubePJPus= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -172,8 +182,12 @@ github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/ghostiam/protogetter v0.3.17 h1:sjGPErP9o7i2Ym+z3LsQzBdLCNaqbYy2iJQPxGXg04Q= github.com/ghostiam/protogetter v0.3.17/go.mod h1:AivIX1eKA/TcUmzZdzbl+Tb8tjIe8FcyG6JFyemQAH4= +github.com/ghostiam/protogetter v0.3.18 h1:yEpghRGtP9PjKvVXtEzGpYfQj1Wl/ZehAfU6fr62Lfo= +github.com/ghostiam/protogetter v0.3.18/go.mod h1:FjIu5Yfs6FT391m+Fjp3fbAYJ6rkL/J6ySpZBfnODuI= github.com/go-critic/go-critic v0.14.2 h1:PMvP5f+LdR8p6B29npvChUXbD1vrNlKDf60NJtgMBOo= github.com/go-critic/go-critic v0.14.2/go.mod h1:xwntfW6SYAd7h1OqDzmN6hBX/JxsEKl5up/Y2bsxgVQ= +github.com/go-critic/go-critic v0.14.3 h1:5R1qH2iFeo4I/RJU8vTezdqs08Egi4u5p6vOESA0pog= +github.com/go-critic/go-critic v0.14.3/go.mod h1:xwntfW6SYAd7h1OqDzmN6hBX/JxsEKl5up/Y2bsxgVQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -209,6 +223,8 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/godoc-lint/godoc-lint v0.10.2 h1:dksNgK+zebnVlj4Fx83CRnCmPO0qRat/9xfFsir1nfg= github.com/godoc-lint/godoc-lint v0.10.2/go.mod h1:KleLcHu/CGSvkjUH2RvZyoK1MBC7pDQg4NxMYLcBBsw= +github.com/godoc-lint/godoc-lint v0.11.1 h1:z9as8Qjiy6miRIa3VRymTa+Gt2RLnGICVikcvlUVOaA= +github.com/godoc-lint/godoc-lint v0.11.1/go.mod h1:BAqayheFSuZrEAqCRxgw9MyvsM+S/hZwJbU1s/ejRj8= github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -251,8 +267,12 @@ github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0a github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= github.com/golangci/golangci-lint/v2 v2.7.2 h1:AhBC+YeEueec4AGlIbvPym5C70Thx0JykIqXbdIXWx0= github.com/golangci/golangci-lint/v2 v2.7.2/go.mod h1:pDijleoBu7e8sejMqyZ3L5n6geqe+cVvOAz2QImqqVc= +github.com/golangci/golangci-lint/v2 v2.8.0 h1:wJnr3hJWY3eVzOUcfwbDc2qbi2RDEpvLmQeNFaPSNYA= +github.com/golangci/golangci-lint/v2 v2.8.0/go.mod h1:xl+HafQ9xoP8rzw0z5AwnO5kynxtb80e8u02Ej/47RI= github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 h1:AkK+w9FZBXlU/xUmBtSJN1+tAI4FIvy5WtnUnY8e4p8= github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95/go.mod h1:k9mmcyWKSTMcPPvQUCfRWWQ9VHJ1U9Dc0R7kaXAgtnQ= +github.com/golangci/golines v0.14.0 h1:xt9d3RKBjhasA3qpoXs99J2xN2t6eBlpLHt0TrgyyXc= +github.com/golangci/golines v0.14.0/go.mod h1:gf555vPG2Ia7mmy2mzmhVQbVjuK8Orw0maR1G4vVAAQ= github.com/golangci/misspell v0.7.0 h1:4GOHr/T1lTW0hhR4tgaaV1WS/lJ+ncvYCoFKmqJsj0c= github.com/golangci/misspell v0.7.0/go.mod h1:WZyyI2P3hxPY2UVHs3cS8YcllAeyfquQcKfdeE9AFVg= github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg= @@ -359,8 +379,12 @@ github.com/ldez/exptostd v0.4.5 h1:kv2ZGUVI6VwRfp/+bcQ6Nbx0ghFWcGIKInkG/oFn1aQ= github.com/ldez/exptostd v0.4.5/go.mod h1:QRjHRMXJrCTIm9WxVNH6VW7oN7KrGSht69bIRwvdFsM= github.com/ldez/gomoddirectives v0.7.1 h1:FaULkvUIG36hj6chpwa+FdCNGZBsD7/fO+p7CCsM6pE= github.com/ldez/gomoddirectives v0.7.1/go.mod h1:auDNtakWJR1rC+YX7ar+HmveqXATBAyEK1KYpsIRW/8= +github.com/ldez/gomoddirectives v0.8.0 h1:JqIuTtgvFC2RdH1s357vrE23WJF2cpDCPFgA/TWDGpk= +github.com/ldez/gomoddirectives v0.8.0/go.mod h1:jutzamvZR4XYJLr0d5Honycp4Gy6GEg2mS9+2YX3F1Q= github.com/ldez/grignotin v0.10.1 h1:keYi9rYsgbvqAZGI1liek5c+jv9UUjbvdj3Tbn5fn4o= github.com/ldez/grignotin v0.10.1/go.mod h1:UlDbXFCARrXbWGNGP3S5vsysNXAPhnSuBufpTEbwOas= +github.com/ldez/structtags v0.6.1 h1:bUooFLbXx41tW8SvkfwfFkkjPYvFFs59AAMgVg6DUBk= +github.com/ldez/structtags v0.6.1/go.mod h1:YDxVSgDy/MON6ariaxLF2X09bh19qL7MtGBN5MrvbdY= github.com/ldez/tagliatelle v0.7.2 h1:KuOlL70/fu9paxuxbeqlicJnCspCRjH0x8FW+NfgYUk= github.com/ldez/tagliatelle v0.7.2/go.mod h1:PtGgm163ZplJfZMZ2sf5nhUT170rSuPgBimoyYtdaSI= github.com/ldez/usetesting v0.5.0 h1:3/QtzZObBKLy1F4F8jLuKJiKBjjVFi1IavpoWbmqLwc= @@ -488,6 +512,8 @@ github.com/sashamelentyev/usestdlibvars v1.29.0 h1:8J0MoRrw4/NAXtjQqTHrbW9NN+3iM github.com/sashamelentyev/usestdlibvars v1.29.0/go.mod h1:8PpnjHMk5VdeWlVb4wCdrB8PNbLqZ3wBZTZWkrpZZL8= github.com/securego/gosec/v2 v2.22.11-0.20251204091113-daccba6b93d7 h1:rZg6IGn0ySYZwCX8LHwZoYm03JhG/cVAJJ3O+u3Vclo= github.com/securego/gosec/v2 v2.22.11-0.20251204091113-daccba6b93d7/go.mod h1:9sr22NZO5Kfh7unW/xZxkGYTmj2484/fCiE54gw7UTY= +github.com/securego/gosec/v2 v2.22.11 h1:tW+weM/hCM/GX3iaCV91d5I6hqaRT2TPsFM1+USPXwg= +github.com/securego/gosec/v2 v2.22.11/go.mod h1:KE4MW/eH0GLWztkbt4/7XpyH0zJBBnu7sYB4l6Wn7Mw= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -644,6 +670,8 @@ golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk= golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= +golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI= +golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -705,6 +733,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I= golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= 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-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -758,6 +788,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= 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.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -831,6 +863,8 @@ golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58 golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ= golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= +golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= +golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/.bingo/variables.env b/.bingo/variables.env index e913cd9e6..a826afbcd 100644 --- a/.bingo/variables.env +++ b/.bingo/variables.env @@ -1,4 +1,4 @@ -# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.9. DO NOT EDIT. +# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.10. DO NOT EDIT. # All tools are designed to be build inside $GOBIN. # Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk. GOBIN=${GOBIN:=$(go env GOBIN)} @@ -12,7 +12,7 @@ BINGO="${GOBIN}/bingo-v0.9.0" GINKGO="${GOBIN}/ginkgo-v2.23.4" -GOLANGCI_LINT="${GOBIN}/golangci-lint-v2.7.2" +GOLANGCI_LINT="${GOBIN}/golangci-lint-v2.8.0" GORELEASER="${GOBIN}/goreleaser-v2.12.7" diff --git a/alpha/declcfg/model_to_declcfg.go b/alpha/declcfg/model_to_declcfg.go index fabb0d0d2..a7732581e 100644 --- a/alpha/declcfg/model_to_declcfg.go +++ b/alpha/declcfg/model_to_declcfg.go @@ -54,7 +54,7 @@ func ConvertFromModel(mpkgs model.Model) DeclarativeConfig { } func traverseModelChannels(mpkg model.Package) ([]Channel, []Bundle) { - channels := []Channel{} + channels := make([]Channel, 0, len(mpkg.Channels)) bundleMap := map[string]*Bundle{} for _, ch := range mpkg.Channels { diff --git a/alpha/model/model.go b/alpha/model/model.go index 3149ae503..1b4e8aff6 100644 --- a/alpha/model/model.go +++ b/alpha/model/model.go @@ -337,7 +337,7 @@ type Bundle struct { func (b *Bundle) VersionString() string { if len(b.Release.Pre) > 0 { - pres := []string{} + pres := make([]string, 0, len(b.Release.Pre)) for _, pre := range b.Release.Pre { pres = append(pres, pre.String()) } diff --git a/alpha/template/semver/semver.go b/alpha/template/semver/semver.go index 22ca94e8d..c9ec14341 100644 --- a/alpha/template/semver/semver.go +++ b/alpha/template/semver/semver.go @@ -347,7 +347,7 @@ func (sv *SemverTemplateData) getVersionsFromChannel(semverBundles []bundleEntry // - within the same minor version (Y-stream), the head of the channel should have a 'skips' encompassing all lesser Y.Z versions of the bundle enumerated in the template. // along the way, uses a highwaterChannel marker to identify the "most stable" channel head to be used as the default channel for the generated package func (sv *SemverTemplateData) generateChannels(semverChannels *bundleVersions) []declcfg.Channel { - outChannels := []declcfg.Channel{} + outChannels := make([]declcfg.Channel, 0, len(*semverChannels)*2) // sort the channel archetypes in ascending order so we can traverse the bundles in order of // their source channel's priority @@ -372,7 +372,7 @@ func (sv *SemverTemplateData) generateChannels(semverChannels *bundleVersions) [ } // sort the bundle names according to their semver, so we can walk in ascending order - bundleNamesByVersion := []string{} + bundleNamesByVersion := make([]string, 0, len(bundles)) for b := range bundles { bundleNamesByVersion = append(bundleNamesByVersion, b) } @@ -424,7 +424,7 @@ func (sv *SemverTemplateData) generateChannels(semverChannels *bundleVersions) [ } func (sv *SemverTemplateData) linkChannels(unlinkedChannels map[string]*declcfg.Channel, entries []entryTuple) []declcfg.Channel { - channels := []declcfg.Channel{} + channels := make([]declcfg.Channel, 0, len(unlinkedChannels)) // sort to force partitioning by archetype --> kind --> semver sort.Slice(entries, func(i, j int) bool { diff --git a/alpha/template/semver/semver_test.go b/alpha/template/semver/semver_test.go index 79b17196b..41a090101 100644 --- a/alpha/template/semver/semver_test.go +++ b/alpha/template/semver/semver_test.go @@ -460,7 +460,7 @@ func TestGenerateChannels(t *testing.T) { }, } - var combinedLinkedChannels []declcfg.Channel + combinedLinkedChannels := make([]declcfg.Channel, 0, len(minorLinkedChannels)+len(majorLinkedChannels)) combinedLinkedChannels = append(combinedLinkedChannels, minorLinkedChannels...) combinedLinkedChannels = append(combinedLinkedChannels, majorLinkedChannels...) slices.SortFunc(combinedLinkedChannels, func(a, b declcfg.Channel) int { diff --git a/pkg/cache/pkgs.go b/pkg/cache/pkgs.go index c89a9aab4..31ab5ad23 100644 --- a/pkg/cache/pkgs.go +++ b/pkg/cache/pkgs.go @@ -54,7 +54,7 @@ func (pkgs packageIndex) GetPackage(_ context.Context, name string) (*registry.P } func (pkgs packageIndex) GetChannelEntriesThatReplace(_ context.Context, name string) ([]*registry.ChannelEntry, error) { - var entries []*registry.ChannelEntry + entries := make([]*registry.ChannelEntry, 0, len(pkgs)) for _, pkg := range pkgs { for _, ch := range pkg.Channels { diff --git a/pkg/lib/bundle/validate.go b/pkg/lib/bundle/validate.go index 4ec65d238..833fa436b 100644 --- a/pkg/lib/bundle/validate.go +++ b/pkg/lib/bundle/validate.go @@ -233,7 +233,7 @@ func validateAnnotations(mediaType string, fileAnnotations *AnnotationMetadata) // Validate the dependencies file func validateDependencies(dependenciesFile *registry.DependenciesFile) []error { - var validationErrors []error + validationErrors := make([]error, 0, len(dependenciesFile.Dependencies)) // Validate dependencies if exists for _, d := range dependenciesFile.Dependencies { diff --git a/pkg/lib/registry/registry.go b/pkg/lib/registry/registry.go index d6be014e1..69f5a38d8 100644 --- a/pkg/lib/registry/registry.go +++ b/pkg/lib/registry/registry.go @@ -436,7 +436,7 @@ func checkForBundles(_ context.Context, _ *sqlite.SQLQuerier, g registry.GraphLo continue } - var headSkips []string + headSkips := make([]string, 0, len(graph.Channels[channel].Nodes[graph.Channels[channel].Head])) for b := range graph.Channels[channel].Nodes[graph.Channels[channel].Head] { headSkips = append(headSkips, b.CsvName) } diff --git a/pkg/lib/validation/bundle_test.go b/pkg/lib/validation/bundle_test.go index 116099384..21ecfd5d9 100644 --- a/pkg/lib/validation/bundle_test.go +++ b/pkg/lib/validation/bundle_test.go @@ -40,12 +40,12 @@ func TestValidateBundle(t *testing.T) { } for _, tt := range table { - unstObjs := []*unstructured.Unstructured{} - // Read all files in manifests directory items, err := os.ReadDir(tt.directory) require.NoError(t, err, "Unable to read directory: %s", tt.description) + unstObjs := make([]*unstructured.Unstructured, 0, len(items)) + for _, item := range items { fileWithPath := filepath.Join(tt.directory, item.Name()) data, err := os.ReadFile(fileWithPath) diff --git a/pkg/registry/bundle_test.go b/pkg/registry/bundle_test.go index a7fd8c8d4..d66533742 100644 --- a/pkg/registry/bundle_test.go +++ b/pkg/registry/bundle_test.go @@ -36,7 +36,7 @@ func TestV1CRDsInBundle(t *testing.T) { } // unmarshal objects into unstructured - unstObjs := []*unstructured.Unstructured{} + unstObjs := make([]*unstructured.Unstructured, 0, len(items)) for _, item := range items { fileWithPath := filepath.Join(manifestDir, item.Name()) data, err := os.ReadFile(fileWithPath) diff --git a/pkg/registry/conversion.go b/pkg/registry/conversion.go index 62bb619f4..933ec51e1 100644 --- a/pkg/registry/conversion.go +++ b/pkg/registry/conversion.go @@ -12,7 +12,7 @@ import ( ) func PackageManifestToAPIPackage(manifest *PackageManifest) *api.Package { - channels := []*api.Channel{} + channels := make([]*api.Channel, 0, len(manifest.Channels)) for _, c := range manifest.Channels { channels = append(channels, PackageChannelToAPIChannel(&c)) } diff --git a/pkg/registry/populator_test.go b/pkg/registry/populator_test.go index d747c18af..e18f4cfe8 100644 --- a/pkg/registry/populator_test.go +++ b/pkg/registry/populator_test.go @@ -602,7 +602,7 @@ func TestQuerierForDependencies(t *testing.T) { }, } - dependencies := []*api.Dependency{} + dependencies := make([]*api.Dependency, 0, len(bundlesList)) for _, b := range bundlesList { dep, err := store.GetDependenciesForBundle(context.TODO(), b.name, b.version, b.path) require.NoError(t, err) @@ -926,7 +926,7 @@ func TestDeprecateBundle(t *testing.T) { // Ensure remaining bundlePaths in db match bundles, err := querier.ListBundles(context.Background()) require.NoError(t, err) - var bundlePaths []string + bundlePaths := make([]string, 0, len(bundles)) for _, bundle := range bundles { bundlePaths = append(bundlePaths, strings.Join([]string{bundle.BundlePath, bundle.ChannelName}, "/")) } @@ -955,7 +955,7 @@ func TestDeprecateBundle(t *testing.T) { require.NoError(t, err) uniqueChannels := make(map[string]struct{}) - var channels []string + channels := make([]string, 0, len(uniqueChannels)) for _, ch := range channelEntries { uniqueChannels[ch.ChannelName] = struct{}{} } @@ -1142,7 +1142,7 @@ func TestDeprecatePackage(t *testing.T) { // Ensure remaining bundlePaths in db match bundles, err := querier.ListBundles(context.Background()) require.NoError(t, err) - var bundlePaths []string + bundlePaths := make([]string, 0, len(bundles)) for _, bundle := range bundles { bundlePaths = append(bundlePaths, strings.Join([]string{bundle.BundlePath, bundle.ChannelName}, "/")) } @@ -1171,7 +1171,7 @@ func TestDeprecatePackage(t *testing.T) { require.NoError(t, err) uniqueChannels := make(map[string]struct{}) - var channels []string + channels := make([]string, 0, len(uniqueChannels)) for _, ch := range channelEntries { uniqueChannels[ch.ChannelName] = struct{}{} } @@ -1667,7 +1667,7 @@ func TestAddAfterDeprecate(t *testing.T) { // Ensure remaining bundlePaths in db match bundles, err := query.ListBundles(context.Background()) require.NoError(t, err) - var remaining []string + remaining := make([]string, 0, len(bundles)) for _, bundle := range bundles { remaining = append(remaining, strings.Join([]string{bundle.BundlePath, bundle.ChannelName}, "/")) } @@ -1696,7 +1696,7 @@ func TestAddAfterDeprecate(t *testing.T) { require.NoError(t, err) uniqueChannels := make(map[string]struct{}) - var channels []string + channels := make([]string, 0, len(uniqueChannels)) for _, ch := range channelEntries { uniqueChannels[ch.ChannelName] = struct{}{} } @@ -2084,7 +2084,7 @@ func TestOverwrite(t *testing.T) { // Ensure remaining bundlePaths in db match bundles, err := query.ListBundles(context.Background()) require.NoError(t, err) - var bundlePaths []string + bundlePaths := make([]string, 0, len(bundles)) for _, bundle := range bundles { bundlePaths = append(bundlePaths, strings.Join([]string{bundle.BundlePath, bundle.ChannelName}, "/")) } @@ -2099,7 +2099,7 @@ func TestOverwrite(t *testing.T) { require.NoError(t, err) uniqueChannels := make(map[string]struct{}) - var channels []string + channels := make([]string, 0, len(uniqueChannels)) for _, ch := range channelEntries { uniqueChannels[ch.ChannelName] = struct{}{} } @@ -2913,7 +2913,7 @@ func TestSubstitutesFor(t *testing.T) { // Ensure bundlePaths in db match bundles, err := query.ListBundles(context.Background()) require.NoError(t, err) - var bundlePaths []string + bundlePaths := make([]string, 0, len(bundles)) for _, bundle := range bundles { bundlePaths = append(bundlePaths, bundle.BundlePath) bundleThatReplaces, _ := query.GetBundleThatReplaces(context.Background(), bundle.CsvName, bundle.PackageName, bundle.ChannelName) diff --git a/pkg/registry/registry_to_model_test.go b/pkg/registry/registry_to_model_test.go index 051bdac0c..7e6233fc0 100644 --- a/pkg/registry/registry_to_model_test.go +++ b/pkg/registry/registry_to_model_test.go @@ -47,18 +47,19 @@ func testExpectedProperties(t *testing.T) []property.Property { if err := json.Unmarshal([]byte(expectedCSV), &csv); err != nil { t.Fatalf("failed to unmarshal CSV: %v", err) } - props := []property.Property{ + props := make([]property.Property, 0, 7+len(testExpectedObjects())) + props = append(props, property.MustBuildPackage("etcd", "0.9.2"), property.MustBuildGVKRequired("etcd.database.coreos.com", "v1beta2", "EtcdCluster"), property.MustBuildGVKRequired("testapi.coreos.com", "v1", "testapi"), property.MustBuildGVK("etcd.database.coreos.com", "v1beta2", "EtcdCluster"), property.MustBuildGVK("etcd.database.coreos.com", "v1beta2", "EtcdBackup"), property.MustBuildGVK("etcd.database.coreos.com", "v1beta2", "EtcdRestore"), - { + property.Property{ Type: "olm.constraint", Value: json.RawMessage(`{"cel":{"rule":"properties.exists(p, p.type == \"certified\")"},"failureMessage":"require to have \"certified\""}`), }, - } + ) for _, obj := range testExpectedObjects() { props = append(props, property.MustBuildBundleObject([]byte(obj))) } diff --git a/pkg/sqlite/migrations/migrations.go b/pkg/sqlite/migrations/migrations.go index b9bb60fba..f978196de 100644 --- a/pkg/sqlite/migrations/migrations.go +++ b/pkg/sqlite/migrations/migrations.go @@ -25,7 +25,7 @@ var migrations MigrationSet = make(map[int]*Migration) // From returns a set of migrations, starting at key func (m MigrationSet) From(key int) Migrations { - keys := make([]int, 0) + keys := make([]int, 0, len(m)) for k := range m { keys = append(keys, k) } @@ -42,7 +42,7 @@ func (m MigrationSet) From(key int) Migrations { // To returns a set of migrations, up to and including key func (m MigrationSet) To(key int) Migrations { - keys := make([]int, 0) + keys := make([]int, 0, len(m)) for k := range m { keys = append(keys, k) } diff --git a/pkg/sqlite/query.go b/pkg/sqlite/query.go index 47c4fe774..d6024d551 100644 --- a/pkg/sqlite/query.go +++ b/pkg/sqlite/query.go @@ -704,7 +704,7 @@ func (s *SQLQuerier) GetApisForEntry(ctx context.Context, entryID int64) ([]*api } argsFor := func(s map[string]struct{}) string { - l := []string{} + l := make([]string, 0, len(s)) for v := range s { l = append(l, "\""+v+"\"") }