Repository: kubewarden/k8s-objects-generator
Pull request #77: chore(deps): update golangci/golangci-lint-action action to v7
Author: login: renovate[bot]
Created: 2025-03-31T14:33:20Z | Merged: 2025-04-23T04:02:17Z

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [golangci/golangci-lint-action](https://redirect.github.com/golangci/golangci-lint-action) | action | major | `v6` -> `v7` |

---

### Release Notes

<details>
<summary>golangci/golangci-lint-action (golangci/golangci-lint-action)</summary>

### [`v7`](https://redirect.github.com/golangci/golangci-lint-action/compare/v6...v7)

[Compare Source](https://redirect.github.com/golangci/golangci-lint-action/compare/v6...v7)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/kubewarden/k8s-objects-generator).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->



Diff:
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index 5512a74..7197ae2 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -20,6 +20,6 @@ jobs:
         with:
           go-version: 1.24
       - name: golangci-lint
-        uses: golangci/golangci-lint-action@v6
+        uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
         with:
-          version: v1.64.7
+          version: latest
diff --git a/.golangci.yml b/.golangci.yml
new file mode 100644
index 0000000..ec79ffe
--- /dev/null
+++ b/.golangci.yml
@@ -0,0 +1,473 @@
+# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
+# Copyright (c) 2021-2025 Marat Reymers
+
+## Golden config for golangci-lint v2.0.2
+#
+# This is the best config for golangci-lint based on my experience and opinion.
+# It is very strict, but not extremely strict.
+# Feel free to adapt it to suit your needs.
+# If this config helps you, please consider keeping a link to this file (see the next comment).
+
+# Based on https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+
+version: "2"
+
+issues:
+  # Maximum count of issues with the same text.
+  # Set to 0 to disable.
+  # Default: 3
+  max-same-issues: 50
+
+formatters:
+  enable:
+    - goimports # checks if the code and import statements are formatted according to the 'goimports' command
+
+    ## you may want to enable
+    #- gci # checks if code and import statements are formatted, with additional rules
+    #- gofmt # checks if the code is formatted according to 'gofmt' command
+
+    ## disabled
+    #- gofumpt # [replaced by goimports, gofumports is not available yet] checks if code and import statements are formatted, with additional rules
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    goimports:
+      # A list of prefixes, which, if set, checks import paths
+      # with the given prefixes are grouped after 3rd-party packages.
+      # Default: []
+      local-prefixes:
+        - github.com/my/project
+
+    golines:
+      # Target maximum line length.
+      # Default: 100
+      max-len: 120
+
+linters:
+  enable:
+    - asasalint # checks for pass []any as any in variadic func(...any)
+    - asciicheck # checks that your code does not contain non-ASCII identifiers
+    - bidichk # checks for dangerous unicode character sequences
+    - bodyclose # checks whether HTTP response body is closed successfully
+    - canonicalheader # checks whether net/http.Header uses canonical header
+    - copyloopvar # detects places where loop variables are copied (Go 1.22+)
+    - cyclop # checks function and package cyclomatic complexity
+    - depguard # checks if package imports are in a list of acceptable packages
+    - dupl # tool for code clone detection
+    - durationcheck # checks for two durations multiplied together
+    - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
+    - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
+    - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
+    - exhaustive # checks exhaustiveness of enum switch statements
+    - exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
+    - fatcontext # detects nested contexts in loops
+    - forbidigo # forbids identifiers
+    - funlen # tool for detection of long functions
+    - gocheckcompilerdirectives # validates go compiler directive comments (//go:)
+    - gochecknoglobals # checks that no global variables exist
+    - gochecknoinits # checks that no init functions are present in Go code
+    - gochecksumtype # checks exhaustiveness on Go "sum types"
+    - gocognit # computes and checks the cognitive complexity of functions
+    - goconst # finds repeated strings that could be replaced by a constant
+    - gocritic # provides diagnostics that check for bugs, performance and style issues
+    - gocyclo # computes and checks the cyclomatic complexity of functions
+    - godot # checks if comments end in a period
+    - goprintffuncname # checks that printf-like functions are named with f at the end
+    - gosec # inspects source code for security problems
+    - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
+    - iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
+    - ineffassign # detects when assignments to existing variables are not used
+    - intrange # finds places where for loops could make use of an integer range
+    - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
+    - makezero # finds slice declarations with non-zero initial length
+    - mirror # reports wrong mirror patterns of bytes/strings usage
+    - mnd # detects magic numbers
+    - musttag # enforces field tags in (un)marshaled structs
+    - nakedret # finds naked returns in functions greater than a specified function length
+    - nestif # reports deeply nested if statements
+    - nilerr # finds the code that returns nil even if it checks that the error is not nil
+    - nilnesserr # reports that it checks for err != nil, but it returns a different nil value error (powered by nilness and nilerr)
+    - nilnil # checks that there is no simultaneous return of nil error and an invalid value
+    - noctx # finds sending http request without context.Context
+    - nolintlint # reports ill-formed or insufficient nolint directives
+    - nonamedreturns # reports all named returns
+    - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
+    - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative
+    - predeclared # finds code that shadows one of Go's predeclared identifiers
+    - promlinter # checks Prometheus metrics naming via promlint
+    - protogetter # reports direct reads from proto message fields when getters should be used
+    - reassign # checks that package variables are not reassigned
+    - recvcheck # checks for receiver type consistency
+    - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
+    - rowserrcheck # checks whether Err of rows is checked successfully
+    - sloglint # ensure consistent code style when using log/slog
+    - spancheck # checks for mistakes with OpenTelemetry/Census spans
+    - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
+    - staticcheck # is a go vet on steroids, applying a ton of static analysis checks
+    - testableexamples # checks if examples are testable (have an expected output)
+    - testifylint # checks usage of github.com/stretchr/testify
+    - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
+    - unconvert # removes unnecessary type conversions
+    - unparam # reports unused function parameters
+    - unused # checks for unused constants, variables, functions and types
+    - usestdlibvars # detects the possibility to use variables/constants from the Go standard library
+    - usetesting # reports uses of functions with replacement inside the testing package
+    - wastedassign # finds wasted assignment statements
+    - whitespace # detects leading and trailing whitespace
+
+    ## you may want to enable
+    #- decorder # checks declaration order and count of types, constants, variables and functions
+    #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized
+    #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
+    #- godox # detects usage of FIXME, TODO and other keywords inside comments
+    #- goheader # checks is file header matches to pattern
+    #- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters
+    #- interfacebloat # checks the number of methods inside an interface
+    #- ireturn # accept interfaces, return concrete types
+    #- prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated
+    #- tagalign # checks that struct tags are well aligned
+    #- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope
+    #- wrapcheck # checks that errors returned from external packages are wrapped
+    #- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event
+
+    ## disabled
+    #- containedctx # detects struct contained context.Context field
+    #- contextcheck # [too many false positives] checks the function whether use a non-inherited context
+    #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
+    #- dupword # [useless without config] checks for duplicate words in the source code
+    #- err113 # [too strict] checks the errors handling expressions
+    #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
+    #- forcetypeassert # [replaced by errcheck] finds forced type assertions
+    #- gomodguard # [use more powerful depguard] allow and block lists linter for direct Go module dependencies
+    #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase
+    #- grouper # analyzes expression groups
+    #- importas # enforces consistent import aliases
+    #- lll # [replaced by golines] reports long lines
+    #- maintidx # measures the maintainability index of each function
+    #- misspell # [useless] finds commonly misspelled English words in comments
+    #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
+    #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
+    #- tagliatelle # checks the struct tags
+    #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
+    #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
+
+    ############################################################################
+    # Kubewarden linter customization
+    # The following linters are disabled because they does not make sense for
+    # the Kubewarden
+    ############################################################################
+
+    # We disable the testpackage linter because we have tests which is not
+    # black boxed and that will not cause issues for us for now.
+    # - testpackage # makes you use a separate _test package
+
+    # We use replace directives in go.mod to replace some dependencies to use
+    # our forked or stripped versions.
+    # - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
+
+    # We have a bunch of places where the function argument list are long.
+    # - golines
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    cyclop:
+      # The maximal code complexity to report.
+      # Default: 10
+      max-complexity: 30
+      # The maximal average package complexity.
+      # If it's higher than 0.0 (float) the check is enabled
+      # Default: 0.0
+      package-average: 10.0
+
+    depguard:
+      # Rules to apply.
+      #
+      # Variables:
+      # - File Variables
+      #   Use an exclamation mark `!` to negate a variable.
+      #   Example: `!$test` matches any file that is not a go test file.
+      #
+      #   `$all` - matches all go files
+      #   `$test` - matches all go test files
+      #
+      # - Package Variables
+      #
+      #   `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
+      #
+      # Default (applies if no custom rules are defined): Only allow $gostd in all files.
+      rules:
+        "deprecated":
+          # List of file globs that will match this list of settings to compare against.
+          # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
+          # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
+          # Default: $all
+          files:
+            - "$all"
+          # List of packages that are not allowed.
+          # Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).
+          # Default: []
+          deny:
+            - pkg: github.com/golang/protobuf
+              desc: Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules
+            - pkg: github.com/satori/go.uuid
+              desc: Use github.com/google/uuid instead, satori's package is not maintained
+            - pkg: github.com/gofrs/uuid$
+              desc: Use github.com/gofrs/uuid/v5 or later, it was not a go module before v5
+        "non-test files":
+          files:
+            - "!$test"
+          deny:
+            - pkg: math/rand$
+              desc: Use math/rand/v2 instead, see https://go.dev/blog/randv2
+        "non-main files":
+          files:
+            - "!**/main.go"
+          deny:
+            - pkg: log$
+              desc: Use log/slog instead, see https://go.dev/blog/slog
+
+    errcheck:
+      # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+      # Such cases aren't reported by default.
+      # Default: false
+      check-type-assertions: true
+
+    exhaustive:
+      # Program elements to check for exhaustiveness.
+      # Default: [ switch ]
+      check:
+        - switch
+        - map
+
+    exhaustruct:
+      # List of regular expressions to exclude struct packages and their names from checks.
+      # Regular expressions must match complete canonical struct package/name/structname.
+      # Default: []
+      exclude:
+        # std libs
+        - ^net/http.Client$
+        - ^net/http.Cookie$
+        - ^net/http.Request$
+        - ^net/http.Response$
+        - ^net/http.Server$
+        - ^net/http.Transport$
+        - ^net/url.URL$
+        - ^os/exec.Cmd$
+        - ^reflect.StructField$
+        # public libs
+        - ^github.com/Shopify/sarama.Config$
+        - ^github.com/Shopify/sarama.ProducerMessage$
+        - ^github.com/mitchellh/mapstructure.DecoderConfig$
+        - ^github.com/prometheus/client_golang/.+Opts$
+        - ^github.com/spf13/cobra.Command$
+        - ^github.com/spf13/cobra.CompletionOptions$
+        - ^github.com/stretchr/testify/mock.Mock$
+        - ^github.com/testcontainers/testcontainers-go.+Request$
+        - ^github.com/testcontainers/testcontainers-go.FromDockerfile$
+        - ^golang.org/x/tools/go/analysis.Analyzer$
+        - ^google.golang.org/protobuf/.+Options$
+        - ^gopkg.in/yaml.v3.Node$
+
+    funlen:
+      # Checks the number of lines in a function.
+      # If lower than 0, disable the check.
+      # Default: 60
+      lines: 100
+      # Checks the number of statements in a function.
+      # If lower than 0, disable the check.
+      # Default: 40
+      statements: 50
+
+    gochecksumtype:
+      # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
+      # Default: true
+      default-signifies-exhaustive: false
+
+    gocognit:
+      # Minimal code complexity to report.
+      # Default: 30 (but we recommend 10-20)
+      min-complexity: 20
+
+    gocritic:
+      # Settings passed to gocritic.
+      # The settings key is the name of a supported gocritic checker.
+      # The list of supported checkers can be find in https://go-critic.github.io/overview.
+      settings:
+        captLocal:
+          # Whether to restrict checker to params only.
+          # Default: true
+          paramsOnly: false
+        underef:
+          # Whether to skip (*x).method() calls where x is a pointer receiver.
+          # Default: true
+          skipRecvDeref: false
+
+    govet:
+      # Enable all analyzers.
+      # Default: false
+      enable-all: true
+      # Disable analyzers by name.
+      # Run `go tool vet help` to see all analyzers.
+      # Default: []
+      disable:
+        - fieldalignment # too strict
+      # Settings per analyzer.
+      settings:
+        shadow:
+          # Whether to be strict about shadowing; can be noisy.
+          # Default: false
+          strict: false
+
+    inamedparam:
+      # Skips check for interface methods with only a single parameter.
+      # Default: false
+      skip-single-param: true
+
+    mnd:
+      # List of function patterns to exclude from analysis.
+      # Values always ignored: `time.Date`,
+      # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
+      # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
+      # Default: []
+      ignored-functions:
+        - args.Error
+        - flag.Arg
+        - flag.Duration.*
+        - flag.Float.*
+        - flag.Int.*
+        - flag.Uint.*
+        - os.Chmod
+        - os.Mkdir.*
+        - os.OpenFile
+        - os.WriteFile
+        - prometheus.ExponentialBuckets.*
+        - prometheus.LinearBuckets
+
+    nakedret:
+      # Make an issue if func has more lines of code than this setting, and it has naked returns.
+      # Default: 30
+      max-func-lines: 0
+
+    nolintlint:
+      # Exclude following linters from requiring an explanation.
+      # Default: []
+      allow-no-explanation: [funlen, gocognit, golines]
+      # Enable to require an explanation of nonzero length after each nolint directive.
+      # Default: false
+      require-explanation: true
+      # Enable to require nolint directives to mention the specific linter being suppressed.
+      # Default: false
+      require-specific: true
+
+    perfsprint:
+      # Optimizes into strings concatenation.
+      # Default: true
+      strconcat: false
+
+    reassign:
+      # Patterns for global variable names that are checked for reassignment.
+      # See https://github.com/curioswitch/go-reassign#usage
+      # Default: ["EOF", "Err.*"]
+      patterns:
+        - ".*"
+
+    revive:
+      rules:
+        # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming
+        - name: var-naming
+          arguments:
+            - []
+            - []
+            # Disable package name checks because we have package names with underscores.
+            - - skipPackageNameChecks: true
+                upperCaseConst: true
+          severity: warning
+          disabled: false
+          exclude:
+            - ""
+
+    rowserrcheck:
+      # database/sql is always checked
+      # Default: []
+      packages:
+        - github.com/jmoiron/sqlx
+
+    sloglint:
+      # Enforce not using global loggers.
+      # Values:
+      # - "": disabled
+      # - "all": report all global loggers
+      # - "default": report only the default slog logger
+      # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-global
+      # Default: ""
+      # Enforce using methods that accept a context.
+      # Values:
+      # - "": disabled
+      # - "all": report all contextless calls
+      # - "scope": report only if a context exists in the scope of the outermost function
+      # https://github.com/go-simpler/sloglint?tab=readme-ov-file#context-only
+      # Default: ""
+      context: scope
+
+    staticcheck:
+      # SAxxxx checks in https://staticcheck.dev/docs/configuration/options/#checks
+      # Example (to disable some checks): [ "all", "-SA1000", "-SA1001"]
+      # Default: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
+      checks:
+        - all
+        # Incorrect or missing package comment.
+        # https://staticcheck.dev/docs/checks/#ST1000
+        - -ST1000
+        # Use consistent method receiver names.
+        # https://staticcheck.dev/docs/checks/#ST1016
+        - -ST1016
+        # Omit embedded fields from selector expression.
+        # https://staticcheck.dev/docs/checks/#QF1008
+        - -QF1008
+        # We use underscore in package names.
+        - -ST1003
+
+    usetesting:
+      # Enable/disable `os.TempDir()` detections.
+      # Default: false
+      os-temp-dir: true
+
+  exclusions:
+    # Log a warning if an exclusion rule is unused.
+    # Default: false
+    warn-unused: true
+    # Predefined exclusion rules.
+    # Default: []
+    presets:
+      - std-error-handling
+      - common-false-positives
+    # Excluding configuration per-path, per-linter, per-text and per-source.
+    rules:
+      - source: "TODO"
+        linters: [godot]
+      - text: "should have a package comment"
+        linters: [revive]
+      - text: 'exported \S+ \S+ should have comment( \(or a comment on this block\))? or be unexported'
+        linters: [revive]
+      - text: 'package comment should be of the form ".+"'
+        source: "// ?(nolint|TODO)"
+        linters: [revive]
+      - text: 'comment on exported \S+ \S+ should be of the form ".+"'
+        source: "// ?(nolint|TODO)"
+        linters: [revive, staticcheck]
+      - path: '_test\.go'
+        linters:
+          - bodyclose
+          - dupl
+          - errcheck
+          - funlen
+          - goconst
+          - gosec
+          - noctx
+          - wrapcheck
+          - gocognit # some tests are complex
+      - path: "object_templates/"
+        linters:
+          - godot
+          - mnd
+          - nonamedreturns
diff --git a/Makefile b/Makefile
index a29f910..ef979ab 100644
--- a/Makefile
+++ b/Makefile
@@ -9,12 +9,12 @@ $(LOCALBIN):
 GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
 
 ## Tool Versions
-GOLANGCI_LINT_VERSION ?= v1.64.7
+GOLANGCI_LINT_VERSION ?= v2.1.2
 
 .PHONY: golangci-lint
 golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
 $(GOLANGCI_LINT): $(LOCALBIN)
-	$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
+	$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
 
 .PHONY: build
 build:
diff --git a/common/constants.go b/common/constants.go
new file mode 100644
index 0000000..55041eb
--- /dev/null
+++ b/common/constants.go
@@ -0,0 +1,3 @@
+package common
+
+const ChunkNumber = 2
diff --git a/download.go b/download.go
index e4d30c3..2ed6d53 100644
--- a/download.go
+++ b/download.go
@@ -3,7 +3,7 @@ package main
 import (
 	"fmt"
 	"io"
-	"log"
+	"log/slog"
 	"net/http"
 
 	"github.com/blang/semver/v4"
@@ -15,32 +15,37 @@ type SwaggerData struct {
 	KubernetesVersion string
 }
 
-// Downloads the swagger file for the Kubernetes version specified by the user
+// DownloadSwagger downloads the swagger file for the Kubernetes version
+// specified by the user.
 func DownloadSwagger(kubeVersion string) (*SwaggerData, error) {
 	version, err := semver.ParseTolerant(kubeVersion)
 	if err != nil {
 		return nil, errors.Wrapf(err, "cannot parse kubernetes version %s", kubeVersion)
 	}
 
-	downloadUrl := fmt.Sprintf(
+	downloadURL := fmt.Sprintf(
 		"https://github.com/kubernetes/kubernetes/raw/v%d.%d.%d/api/openapi-spec/swagger.json",
 		version.Major, version.Minor, version.Patch)
 
-	log.Printf("Downloading swagger file for Kubernetes %s from %s", version.String(), downloadUrl)
+	slog.Info("Downloading swagger file for Kubernetes", "version", version.String(), "downloadURL", downloadURL)
 
-	resp, err := http.Get(downloadUrl)
+	resp, err := http.Get(downloadURL) //nolint:gosec,noctx // let's keep the code simple, we just do 1 request..
 	if err != nil {
-		return nil, errors.Wrapf(err, "Cannot fetch swagger file from %s", downloadUrl)
+		return nil, errors.Wrapf(err, "Cannot fetch swagger file from %s", downloadURL)
 	}
-	defer resp.Body.Close()
+	defer func() {
+		if cerr := resp.Body.Close(); cerr != nil {
+			slog.Info("failed to close response body", "error", cerr)
+		}
+	}()
 
 	body, err := io.ReadAll(resp.Body)
 	if err != nil {
-		return nil, errors.Wrapf(err, "Cannot read contents of response from %s", downloadUrl)
+		return nil, errors.Wrapf(err, "Cannot read contents of response from %s", downloadURL)
 	}
 
-	if resp.StatusCode > 299 {
-		return nil, fmt.Errorf("Response failed with status code: %d and body: %s", resp.StatusCode, string(body))
+	if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
+		return nil, fmt.Errorf("response failed with status code: %d and body: %s", resp.StatusCode, string(body))
 	}
 
 	return &SwaggerData{
diff --git a/main.go b/main.go
index 9242920..b3ba4c8 100644
--- a/main.go
+++ b/main.go
@@ -18,98 +18,116 @@ var LICENSE string
 
 func main() {
 	var swaggerFile, kubeVersion, outputDir, gitRepo string
-	var swaggerData *SwaggerData
-	var err error
-
 	flag.StringVar(&swaggerFile, "f", "", "The swagger file to process")
 	flag.StringVar(&kubeVersion, "kube-version", "", "Fetch the swagger file of the specified Kubernetes version")
 	flag.StringVar(&outputDir, "o", "./k8s-objects", "The root directory where the files will be generated")
 	flag.StringVar(&gitRepo, "repo", "github.com/kubewarden/k8s-objects", "The repository where the generated files are going to be published")
-
 	flag.Parse()
 
+	validateFlags(swaggerFile, kubeVersion)
+
+	swaggerData := fetchSwaggerData(swaggerFile, kubeVersion)
+	outputDir = resolveOutputDir(outputDir)
+
+	templatesTmpDir := createTemplatesDir()
+	defer cleanupTemplatesDir(templatesTmpDir)
+
+	writeTemplatesOrPanic(templatesTmpDir)
+
+	project := initializeProject(outputDir, gitRepo, templatesTmpDir, swaggerData)
+	generateSwaggerFiles(project)
+}
+
+func validateFlags(swaggerFile, kubeVersion string) {
 	if swaggerFile != "" && kubeVersion != "" {
 		log.Fatal("`-f` and `-kube-version` flags cannot be used at the same time")
 	}
-
 	if len(swaggerFile) == 0 && len(kubeVersion) == 0 {
 		log.Fatal("one of the `-f` or `-kube-version` flag must be specified")
 	}
+}
 
+func fetchSwaggerData(swaggerFile, kubeVersion string) *SwaggerData {
 	if kubeVersion != "" {
-		swaggerData, err = DownloadSwagger(kubeVersion)
+		swaggerData, err := DownloadSwagger(kubeVersion)
 		if err != nil {
 			log.Fatal(err)
 		}
+		return swaggerData
 	}
-	if swaggerFile != "" {
-		data, err := os.ReadFile(swaggerFile)
-		if err != nil {
-			log.Fatalf("cannot read swagger file %s: %v", swaggerFile, err)
-		}
-		swaggerData = &SwaggerData{
-			Data:              data,
-			KubernetesVersion: "unknown",
-		}
+	data, err := os.ReadFile(swaggerFile)
+	if err != nil {
+		log.Fatalf("cannot read swagger file %s: %v", swaggerFile, err)
+	}
+	return &SwaggerData{
+		Data:              data,
+		KubernetesVersion: "unknown",
 	}
+}
 
-	outputDir, err = filepath.Abs(outputDir)
+func resolveOutputDir(outputDir string) string {
+	absOutputDir, err := filepath.Abs(outputDir)
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
+	return absOutputDir
+}
 
+func createTemplatesDir() string {
 	templatesTmpDir, err := os.MkdirTemp("", "k8s-objects-generator-swagger-templates")
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
+	log.Printf("Created templates at %s", templatesTmpDir)
+	return templatesTmpDir
+}
 
-	if err = writeTemplates(templatesTmpDir); err != nil {
-		log.Fatal(err)
+func cleanupTemplatesDir(templatesTmpDir string) {
+	if err := os.RemoveAll(templatesTmpDir); err != nil {
+		log.Printf("error removing the temporary directory that holds swagger templates '%s': %v", templatesTmpDir, err)
 	}
-	log.Printf("Created templates at %s", templatesTmpDir)
+}
 
-	defer func() {
-		if err := os.RemoveAll(templatesTmpDir); err != nil {
-			log.Printf("error removing the temporary directory that holds swagger templates '%s': %v",
-				templatesTmpDir, err)
-		}
-	}()
+func writeTemplatesOrPanic(templatesTmpDir string) {
+	if err := writeTemplates(templatesTmpDir); err != nil {
+		log.Panic(err)
+	}
+}
 
-	project, err := split.NewProject(
-		outputDir,
-		gitRepo,
-		filepath.Join(templatesTmpDir, "swagger_templates"),
-	)
+func initializeProject(outputDir, gitRepo, templatesTmpDir string, swaggerData *SwaggerData) *split.Project {
+	project, err := split.NewProject(outputDir, gitRepo, filepath.Join(templatesTmpDir, "swagger_templates"))
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
-
 	log.Print("Initializing target directory")
 	err = project.Init(swaggerData.Data, swaggerData.KubernetesVersion, LICENSE)
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
+	return &project
+}
 
+func generateSwaggerFiles(project *split.Project) {
 	splitter, err := split.NewSplitter(project.SwaggerFile())
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
 
 	refactoringPlan, err := splitter.ComputeRefactoringPlan()
 	if err != nil {
-		log.Fatal(err)
+		log.Panic(err)
 	}
 
-	if err := splitter.GenerateSwaggerFiles(project, refactoringPlan); err != nil {
-		log.Fatal(err)
+	if err := splitter.GenerateSwaggerFiles(*project, refactoringPlan); err != nil {
+		log.Panic(err)
 	}
 
 	groupResource := split.NewGroupResource(afero.NewOsFs())
-	if err := groupResource.Generate(project, refactoringPlan); err != nil {
-		log.Fatal(err)
+	if err := groupResource.Generate(*project, refactoringPlan); err != nil {
+		log.Panic(err)
 	}
 
 	if err := project.RunGoModTidy(); err != nil {
-		log.Fatal(errors.Wrap(err, "error running go mod tidy"))
+		log.Panic(errors.Wrap(err, "error running go mod tidy"))
 	}
 }
diff --git a/split/groupresource.go b/split/groupresource.go
index 8ec9d55..ac6c60d 100644
--- a/split/groupresource.go
+++ b/split/groupresource.go
@@ -3,7 +3,7 @@ package split
 import (
 	"fmt"
 	"io/fs"
-	"log"
+	"log/slog"
 	"os"
 	"path/filepath"
 	"strings"
@@ -14,7 +14,7 @@ import (
 	"github.com/spf13/afero"
 
 	"github.com/kubewarden/k8s-objects-generator/object_templates"
-	"github.com/kubewarden/k8s-objects-generator/swagger_helpers"
+	"github.com/kubewarden/k8s-objects-generator/swaggerhelpers"
 )
 
 const (
@@ -57,8 +57,8 @@ func (g *groupResource) Generate(project Project, plan *RefactoringPlan) error {
 	var lastGVK *groupVersionResource
 	var gvkCount int
 	for _, pkg := range plan.Packages {
-		log.Println("============================================================================")
-		log.Println("Generating GVK files for module", pkg.Name)
+		slog.Info("============================================================================")
+		slog.Info("Generating GVK files for module", "module", pkg.Name)
 		for _, dfn := range pkg.Definitions {
 			if gvk := groupKindResource(dfn); gvk != nil {
 				gvkCount++
@@ -76,8 +76,8 @@ func (g *groupResource) Generate(project Project, plan *RefactoringPlan) error {
 				return err
 			}
 
-			log.Printf("Generated GVK files (visited %d/%d)", gvkCount, len(pkg.Definitions))
-			log.Println("Generated group_info.go file")
+			slog.Info("Generated GVK files", "visited", gvkCount, "total", len(pkg.Definitions))
+			slog.Info("Generated group_info.go file")
 			lastGVK, gvkCount = nil, 0
 		}
 	}
@@ -86,20 +86,25 @@ func (g *groupResource) Generate(project Project, plan *RefactoringPlan) error {
 }
 
 func (g *groupResource) generateResourceFile(path string, templ *template.Template, gvk *groupVersionResource) error {
-	gvkFile, err := g.fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0644)
+	gvkFile, err := g.fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o600) //nolint:mnd // mnd doesn't support file octals yet
 	if err != nil {
 		return err
 	}
-	defer gvkFile.Close()
+
+	defer func() {
+		if cerr := gvkFile.Close(); cerr != nil {
+			slog.Error("failed to close file %s: %v", "path", path, "error", cerr)
+		}
+	}()
 
 	if err := templ.Execute(gvkFile, gvk); err != nil {
-		return fmt.Errorf("failed to process template for %s: %v", gvk.String(), err)
+		return fmt.Errorf("failed to process template for %s: %w", gvk.String(), err)
 	}
 
 	return nil
 }
 
-func groupKindResource(definition *swagger_helpers.Definition) *groupVersionResource {
+func groupKindResource(definition *swaggerhelpers.Definition) *groupVersionResource {
 	extension := definition.SwaggerDefinition.Extensions
 	if extension == nil || extension[kubernetesGroupVersionKindKey] == nil {
 		return nil
@@ -107,7 +112,7 @@ func groupKindResource(definition *swagger_helpers.Definition) *groupVersionReso
 
 	kubeExtension, isKubeExtension := asKubernetesExtension(extension)
 	if !isKubeExtension {
-		log.Printf("GVK specific %s key format for %s package definition is not found. Skipping...", kubernetesGroupVersionKindKey, definition.PackageName)
+		slog.Info("GVK specific key format for package definition is not found. Skipping...", "GVK", kubernetesGroupVersionKindKey, "package", definition.PackageName)
 		return nil
 	}
 
@@ -119,8 +124,8 @@ func groupKindResource(definition *swagger_helpers.Definition) *groupVersionReso
 }
 
 func (g *groupResource) copyStaticFiles(targetRoot string) error {
-	log.Println("============================================================================")
-	log.Println("Generating static content files")
+	slog.Info("============================================================================")
+	slog.Info("Generating static content files")
 	err := fs.WalkDir(object_templates.ApimachineryRoot, ".", func(path string, d fs.DirEntry, err error) error {
 		if err != nil {
 			return err
@@ -139,19 +144,23 @@ func (g *groupResource) copyStaticFiles(targetRoot string) error {
 			return nil
 		}
 		targetFilePath := filepath.Join(targetRoot, path)
-		targetFile, err := g.fs.OpenFile(targetFilePath, os.O_CREATE|os.O_RDWR, 0644)
+		targetFile, err := g.fs.OpenFile(targetFilePath, os.O_CREATE|os.O_RDWR, 0o600) //nolint:mnd // mnd doesn't support file octals yet
 		if err != nil {
 			return err
 		}
-		log.Println("File", filepath.Base(path), "copied into the", filepath.Dir(targetFilePath))
-		defer targetFile.Close()
+		slog.Info("File copied", "File", filepath.Base(path), "destination", filepath.Dir(targetFilePath))
+		defer func() {
+			if cerr := targetFile.Close(); cerr != nil {
+				slog.Error("failed to close file", "path", path, "error", cerr)
+			}
+		}()
 		if _, err = targetFile.Write(sourceBuf); err != nil {
 			return err
 		}
 
 		return nil
 	})
-	log.Println("============================================================================")
+	slog.Info("============================================================================")
 
 	return err
 }
diff --git a/split/groupresource_test.go b/split/groupresource_test.go
index b65866a..feb8cb2 100644
--- a/split/groupresource_test.go
+++ b/split/groupresource_test.go
@@ -8,6 +8,7 @@ import (
 	"github.com/go-openapi/spec"
 	"github.com/spf13/afero"
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 //go:embed testdata/event_gvk.go.gold
@@ -18,12 +19,12 @@ var groupInfoGold string
 
 func TestKubernetesExtensionParse(t *testing.T) {
 	tests := []struct {
-		extensionJson   string
+		extensionJSON   string
 		extensionParsed bool
 		expectedGVK     *groupVersionResource
 	}{
 		{
-			extensionJson: `{"x-kubernetes-group-version-kind": [
+			extensionJSON: `{"x-kubernetes-group-version-kind": [
         						{
           							"group": "events.k8s.io",
 									"kind": "Event",
@@ -38,7 +39,7 @@ func TestKubernetesExtensionParse(t *testing.T) {
 			},
 		},
 		{
-			extensionJson: `{"x-kubernetes-group-version-kind": [
+			extensionJSON: `{"x-kubernetes-group-version-kind": [
         						{
           							"group": "",
           							"kind": "DeleteOptions",
@@ -56,7 +57,7 @@ func TestKubernetesExtensionParse(t *testing.T) {
 
 	for _, tt := range tests {
 		extension := spec.VendorExtensible{}
-		assert.NoError(t, extension.UnmarshalJSON([]byte(tt.extensionJson)))
+		require.NoError(t, extension.UnmarshalJSON([]byte(tt.extensionJSON)))
 		kubeExtension, isKubeExtension := asKubernetesExtension(extension.Extensions)
 		assert.Equal(t, isKubeExtension, tt.extensionParsed)
 		if tt.extensionParsed {
@@ -70,22 +71,22 @@ func TestKubernetesExtensionParse(t *testing.T) {
 func TestGenerateGroupResources(t *testing.T) {
 	outputDir := "/testout"
 	project, err := NewProject(outputDir, "", "")
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	splitter, err := NewSplitter(filepath.Join("testdata", "test-swagger.json"))
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	refactoringPlan, err := splitter.ComputeRefactoringPlan()
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	fs := afero.NewMemMapFs()
 	groupResource := NewGroupResource(fs)
-	assert.NoError(t, groupResource.Generate(project, refactoringPlan))
+	require.NoError(t, groupResource.Generate(project, refactoringPlan))
 
 	eventGvk, err := afero.ReadFile(fs, filepath.Join(outputDir, "src/api/events/v1/event_gvk.go"))
-	assert.NoError(t, err)
+	require.NoError(t, err)
 	groupInfo, err := afero.ReadFile(fs, filepath.Join(outputDir, "src/api/events/v1/group_info.go"))
-	assert.NoError(t, err)
+	require.NoError(t, err)
 
 	assert.Equal(t, eventGvkGold, string(eventGvk))
 	assert.Equal(t, groupInfoGold, string(groupInfo))
diff --git a/split/project.go b/split/project.go
index 6f00553..385990e 100644
--- a/split/project.go
+++ b/split/project.go
@@ -3,7 +3,7 @@ package split
 import (
 	"bytes"
 	"fmt"
-	"log"
+	"log/slog"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -12,6 +12,7 @@ import (
 
 	"github.com/pkg/errors"
 
+	"github.com/kubewarden/k8s-objects-generator/common"
 	"github.com/kubewarden/k8s-objects-generator/object_templates"
 )
 
@@ -44,7 +45,7 @@ func (p *Project) Init(swaggerData []byte, kubernetesVersion, license string) er
 		return errors.Wrapf(err, "cannot cleanup dir %s", p.Root)
 	}
 
-	if err = os.MkdirAll(p.Root, os.ModePerm); err != nil {
+	if err = os.MkdirAll(p.Root, 0o750); err != nil {
 		return errors.Wrapf(err, "cannot create dir %s", p.Root)
 	}
 
@@ -52,33 +53,33 @@ func (p *Project) Init(swaggerData []byte, kubernetesVersion, license string) er
 	if err = goModInit(goModFileName, p.GitRepo); err != nil {
 		return errors.Wrapf(err, "cannot create go.mod file %s", goModFileName)
 	}
-	log.Printf("Created `go.mod` under %s", goModFileName)
+	slog.Info("Created `go.mod`", "path", goModFileName)
 
 	swaggerFileName := p.SwaggerFile()
-	if err := os.WriteFile(swaggerFileName, swaggerData, 0644); err != nil {
+	if err = os.WriteFile(swaggerFileName, swaggerData, 0o600); err != nil {
 		return errors.Wrapf(err, "cannot write swagger file inside of project root: %s", swaggerFileName)
 	}
 
 	kubernetesVersionFile := filepath.Join(p.Root, "KUBERNETES_VERSION")
-	err = os.WriteFile(kubernetesVersionFile, []byte(kubernetesVersion), 0644)
+	err = os.WriteFile(kubernetesVersionFile, []byte(kubernetesVersion), 0o600)
 	if err != nil {
 		return errors.Wrapf(err, "cannot write KUBERNETES_VERSION file %s", kubernetesVersionFile)
 	}
 
 	licenseFile := filepath.Join(p.Root, "LICENSE")
-	err = os.WriteFile(licenseFile, []byte(license), 0644)
+	err = os.WriteFile(licenseFile, []byte(license), 0o600)
 	if err != nil {
 		return errors.Wrapf(err, "cannot write LICENSE file %s", licenseFile)
 	}
 
 	readmeFile := filepath.Join(p.Root, "README.md")
-	err = os.WriteFile(readmeFile, []byte(object_templates.Readme), 0644)
+	err = os.WriteFile(readmeFile, []byte(object_templates.Readme), 0o600)
 	if err != nil {
 		return errors.Wrapf(err, "cannot write README.md file %s", readmeFile)
 	}
 
 	gitignoreFile := filepath.Join(p.Root, ".gitignore")
-	err = os.WriteFile(gitignoreFile, []byte(object_templates.GitIgnore), 0644)
+	err = os.WriteFile(gitignoreFile, []byte(object_templates.GitIgnore), 0o600)
 	if err != nil {
 		return errors.Wrapf(err, "cannot write .gitignore file %s", licenseFile)
 	}
@@ -153,7 +154,7 @@ func (p *Project) InvokeSwaggerModelGenerator(packageName string) error {
 	cmdName := "swagger"
 
 	packageNameChunks := strings.Split(packageName, "/")
-	if len(packageNameChunks) < 2 {
+	if len(packageNameChunks) < common.ChunkNumber {
 		return fmt.Errorf("package name %s doesn't have enough chunks", packageName)
 	}
 
@@ -211,9 +212,9 @@ func runCmd(cmdName string, args []string, extraEnv map[string]string, dir strin
 
 	err := cmd.Run()
 	if err != nil {
-		log.Printf("CMD: %+v", cmd)
-		log.Printf("STDOUT: %s", stdout.String())
-		log.Printf("STDERR: %s", stderr.String())
+		slog.Info("CMD output", "string", cmd)
+		slog.Info("STDOUT output", "string", stdout.String())
+		slog.Info("STDERR output", "string", stderr.String())
 	}
 	return err
 }
diff --git a/split/refactoring_plan.go b/split/refactoring_plan.go
index 08da27c..ec145ea 100644
--- a/split/refactoring_plan.go
+++ b/split/refactoring_plan.go
@@ -5,21 +5,21 @@ import (
 
 	openapi_spec "github.com/go-openapi/spec"
 	"github.com/heimdalr/dag"
-	"github.com/kubewarden/k8s-objects-generator/swagger_helpers"
+	"github.com/kubewarden/k8s-objects-generator/swaggerhelpers"
 	"github.com/pkg/errors"
 )
 
-// Holds information about how the big swagger file is going to be split
+// RefactoringPlan holds information about how the big swagger file is going to be split.
 type RefactoringPlan struct {
-	Packages          map[string]swagger_helpers.Package
-	Interfaces        swagger_helpers.InterfaceRegistry
+	Packages          map[string]swaggerhelpers.Package
+	Interfaces        swaggerhelpers.InterfaceRegistry
 	SwaggerVersion    string
 	KubernetesVersion string
 }
 
 func NewRefactoringPlan(swagger *openapi_spec.Swagger) (*RefactoringPlan, error) {
-	packages := make(map[string]swagger_helpers.Package)
-	interfaces := swagger_helpers.NewInterfaceRegistry()
+	packages := make(map[string]swaggerhelpers.Package)
+	interfaces := swaggerhelpers.NewInterfaceRegistry()
 
 	kubernetesVersion := "undefined"
 	if swagger.Info != nil {
@@ -27,7 +27,7 @@ func NewRefactoringPlan(swagger *openapi_spec.Swagger) (*RefactoringPlan, error)
 	}
 
 	for id, definition := range swagger.Definitions {
-		newDefinitionRefactoringPlan, err := swagger_helpers.NewDefinition(definition, id)
+		newDefinitionRefactoringPlan, err := swaggerhelpers.NewDefinition(definition, id)
 		if err != nil {
 			return nil, errors.Wrapf(err, "cannot parse definition with id %s", id)
 		}
@@ -35,14 +35,13 @@ func NewRefactoringPlan(swagger *openapi_spec.Swagger) (*RefactoringPlan, error)
 		if ((len(definition.Type) == 1 && definition.Type[0] == "object") || (len(definition.Type) == 0)) &&
 			len(definition.Properties) == 0 &&
 			definition.AdditionalProperties == nil {
-
 			// this is a go interface
 			interfaces.RegisterInterface(newDefinitionRefactoringPlan.PackageName, newDefinitionRefactoringPlan.TypeName)
 		}
 
 		pkg, pkgKnown := packages[newDefinitionRefactoringPlan.PackageName]
 		if !pkgKnown {
-			pkg = swagger_helpers.NewPackage(newDefinitionRefactoringPlan.PackageName)
+			pkg = swaggerhelpers.NewPackage(newDefinitionRefactoringPlan.PackageName)
 		}
 
 		pkg.AddDefinitionRefactoringPlan(newDefinitionRefactoringPlan)
@@ -61,35 +60,17 @@ func (r *RefactoringPlan) DependenciesGraph() (*dag.DAG, error) {
 	dependenciesGraph := dag.NewDAG()
 
 	for pkgName, pkg := range r.Packages {
-		if _, err := dependenciesGraph.GetVertex(pkgName); err != nil {
-			// the package is not yet known by the DAG
-			err := dependenciesGraph.AddVertexByID(pkgName, pkgName)
-			if err != nil {
-				return nil, err
-			}
+		if err := addVertexIfNotExists(dependenciesGraph, pkgName); err != nil {
+			return nil, err
 		}
 
 		for name := range pkg.Dependencies.Iterator().C {
-			// ensure the dependency is known by the DAG
-			if _, err := dependenciesGraph.GetVertex(name); err != nil {
-				_, found := r.Packages[name]
-				if !found {
-					return nil, fmt.Errorf("unsolved dependency: cannot find package %s inside of list of known packages", name)
-				}
-
-				// the package is not yet known by the DAG
-				err := dependenciesGraph.AddVertexByID(name, name)
-				if err != nil {
-					return nil, err
-				}
+			if err := ensureDependencyExists(dependenciesGraph, name, r.Packages); err != nil {
+				return nil, err
 			}
 
-			// register the dependency relation
-			// this namespace depends on `depName`
 			if err := dependenciesGraph.AddEdge(name, pkgName); err != nil {
-				return nil, errors.Wrapf(err,
-					"Cannot register the dependency relation that %s has against %s",
-					pkgName, name)
+				return nil, err
 			}
 		}
 	}
@@ -97,6 +78,23 @@ func (r *RefactoringPlan) DependenciesGraph() (*dag.DAG, error) {
 	return dependenciesGraph, nil
 }
 
+func addVertexIfNotExists(graph *dag.DAG, vertexID string) error {
+	if _, err := graph.GetVertex(vertexID); err != nil {
+		return graph.AddVertexByID(vertexID, vertexID)
+	}
+	return nil
+}
+
+func ensureDependencyExists(graph *dag.DAG, dependency string, packages map[string]swaggerhelpers.Package) error {
+	if _, err := graph.GetVertex(dependency); err != nil {
+		if _, found := packages[dependency]; !found {
+			return fmt.Errorf("unsolved dependency: cannot find package %s inside of list of known packages", dependency)
+		}
+		return graph.AddVertexByID(dependency, dependency)
+	}
+	return nil
+}
+
 func (r *RefactoringPlan) RenderNewSwaggerFiles(githubRepo string) (map[string]string, error) {
 	renderedFiles := make(map[string]string)
 
diff --git a/split/refactoring_plan_test.go b/split/refactoring_plan_test.go
index 6a5c115..d612f3c 100644
--- a/split/refactoring_plan_test.go
+++ b/split/refactoring_plan_test.go
@@ -12,15 +12,15 @@ func TestNewRefactoringPlan(t *testing.T) {
 	kubernetesVersion := "1.23"
 
 	swagger := openapi_spec.Swagger{}
-	swagger.SwaggerProps.Swagger = swaggerVersion
+	swagger.Swagger = swaggerVersion
 
 	paths := openapi_spec.Paths{}
-	swagger.SwaggerProps.Paths = &paths
+	swagger.Paths = &paths
 
 	info := openapi_spec.Info{}
-	info.InfoProps.Title = "kubernetes"
-	info.InfoProps.Version = kubernetesVersion
-	swagger.SwaggerProps.Info = &info
+	info.Title = "kubernetes"
+	info.Version = kubernetesVersion
+	swagger.Info = &info
 	swagger.Definitions = make(openapi_spec.Definitions)
 
 	// First definition
diff --git a/split/splitter.go b/split/splitter.go
index 876f7ad..4f30010 100644
--- a/split/splitter.go
+++ b/split/splitter.go
@@ -2,6 +2,7 @@ package split
 
 import (
 	"fmt"
+	"log/slog"
 	"os"
 	"path/filepath"
 
@@ -9,8 +10,8 @@ import (
 	"github.com/pkg/errors"
 )
 
-// Takes care of splitting the single big swagger file of Kubernetes
-// into smaller ones, one package
+// Splitter takes care of splitting the single big swagger file of Kubernetes
+// into smaller ones, one package.
 type Splitter struct {
 	vanillaSwagger openapi_spec.Swagger
 }
@@ -42,23 +43,23 @@ func (s *Splitter) GenerateSwaggerFiles(project Project, plan *RefactoringPlan)
 	}
 
 	for pkgName, jsonData := range swaggerFiles {
-		fmt.Printf("Generating models for package %s\n", pkgName)
+		slog.Info("Generating models for package", "package", pkgName)
 
 		pathToSwagger := filepath.Join(project.OutputDir,
 			"src",
 			project.GitRepo,
 			pkgName)
-		if err := os.MkdirAll(pathToSwagger, 0777); err != nil {
+		if err := os.MkdirAll(pathToSwagger, 0o750); err != nil {
 			return errors.Wrapf(err, "cannot create directory %s", pathToSwagger)
 		}
 
 		fileName := filepath.Join(pathToSwagger, "swagger.json")
-		if err := os.WriteFile(fileName, []byte(jsonData), 0644); err != nil {
+		if err := os.WriteFile(fileName, []byte(jsonData), 0o600); err != nil {
 			return errors.Wrapf(err, "cannot write %s", fileName)
 		}
 
 		if err := project.InvokeSwaggerModelGenerator(pkgName); err != nil {
-			return fmt.Errorf("swagger execution failed for module %s: %+v", pkgName, err)
+			return fmt.Errorf("swagger execution failed for module %s: %+w", pkgName, err)
 		}
 	}
 
diff --git a/swagger_helpers/definition.go b/swaggerhelpers/definition.go
similarity index 87%
rename from swagger_helpers/definition.go
rename to swaggerhelpers/definition.go
index d7a8214..40f6c0e 100644
--- a/swagger_helpers/definition.go
+++ b/swaggerhelpers/definition.go
@@ -1,4 +1,4 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	"fmt"
@@ -7,9 +7,11 @@ import (
 	mapset "github.com/deckarep/golang-set/v2"
 	openapi_spec "github.com/go-openapi/spec"
 	"github.com/pkg/errors"
+
+	"github.com/kubewarden/k8s-objects-generator/common"
 )
 
-// Wrapper around a Swagger Definition
+// Definition is wrapper around a Swagger Definition.
 type Definition struct {
 	// Original definition
 	SwaggerDefinition openapi_spec.Schema
@@ -34,7 +36,7 @@ func NewDefinition(definition openapi_spec.Schema, id string) (*Definition, erro
 
 	path := strings.TrimPrefix(id, "io.k8s.")
 	chunks := strings.Split(path, ".")
-	if len(chunks) < 2 {
+	if len(chunks) < common.ChunkNumber {
 		return nil,
 			fmt.Errorf("cannot build definition refactoring plan: wrong number of chunks: %v", chunks)
 	}
@@ -64,11 +66,12 @@ func patchDefinition(definition *openapi_spec.Schema, id string) {
 	}
 }
 
+//nolint:gocognit // keep cognitive complexity as it is, this function is quite contained
 func (d *Definition) computeDependencies() error {
 	var propImports []PropertyImport
 
 	for name, property := range d.SwaggerDefinition.Properties {
-		propImport, err := NewPropertyImportFromRef(&property.SchemaProps.Ref)
+		propImport, err := NewPropertyImportFromRef(&property.Ref)
 		if err != nil {
 			return errors.Wrapf(err,
 				"cannot parse ref pointer for property %s inside of %s/%s",
@@ -79,7 +82,7 @@ func (d *Definition) computeDependencies() error {
 		}
 
 		if property.Items != nil && property.Items.Schema != nil {
-			propImport, err := NewPropertyImportFromRef(&property.Items.Schema.SchemaProps.Ref)
+			propImport, err := NewPropertyImportFromRef(&property.Items.Schema.Ref)
 			if err != nil {
 				return errors.Wrapf(err,
 					"cannot parse ref pointer for property item %s inside of %s/%s",
@@ -91,7 +94,7 @@ func (d *Definition) computeDependencies() error {
 		}
 
 		if property.AdditionalProperties != nil {
-			propImport, err := NewPropertyImportFromRef(&property.AdditionalProperties.Schema.SchemaProps.Ref)
+			propImport, err := NewPropertyImportFromRef(&property.AdditionalProperties.Schema.Ref)
 			if err != nil {
 				return errors.Wrapf(err,
 					"cannot parse ref pointer for additional property %s inside of %s/%s",
@@ -128,7 +131,7 @@ func (d *Definition) GeneratePatchedOpenAPIDef(gitRepo string, interfaces *Inter
 		outerObj["import"] = importObj
 		outerObj["type"] = "RawMessage"
 
-		definition.VendorExtensible.AddExtension("x-go-type", outerObj)
+		definition.AddExtension("x-go-type", outerObj)
 		return definition, nil
 	}
 
@@ -163,15 +166,15 @@ func (d *Definition) GeneratePatchedOpenAPIDef(gitRepo string, interfaces *Inter
 	return definition, nil
 }
 
-// Changes the Ref value of the provided schema object to replace all
-// references with x-go-import statements
+// patchSchemaRef changes the Ref value of the provided schema object to replace all
+// references with x-go-import statements.
 func patchSchemaRef(schema *openapi_spec.Schema,
 	definitionPackage string,
 	interfaces *InterfaceRegistry,
 	isRequired bool,
 	gitRepo string,
 ) error {
-	propImport, err := NewPropertyImportFromRef(&schema.SchemaProps.Ref)
+	propImport, err := NewPropertyImportFromRef(&schema.Ref)
 	if err != nil {
 		return err
 	}
@@ -184,17 +187,17 @@ func patchSchemaRef(schema *openapi_spec.Schema,
 
 	if !isRequired {
 		// non-required properties have `json:"omitempty"` set
-		schema.VendorExtensible.AddExtension("x-omitempty", true)
+		schema.AddExtension("x-omitempty", true)
 
 		isBasicType := true
-		if schema.SchemaProps.Ref.GetPointer() != nil && !schema.SchemaProps.Ref.GetPointer().IsEmpty() {
+		if schema.Ref.GetPointer() != nil && !schema.SchemaProps.Ref.GetPointer().IsEmpty() {
 			isBasicType = false
 		}
 
 		if !isBasicType && !isInterface {
 			// in addition to that, non-required objects must be set to nullable
 			// so that the generated code will reference them by pointer
-			schema.VendorExtensible.AddExtension("x-nullable", true)
+			schema.AddExtension("x-nullable", true)
 		}
 	}
 
@@ -209,17 +212,17 @@ func patchSchemaRef(schema *openapi_spec.Schema,
 		if err != nil {
 			return err
 		}
-		schema.SchemaProps.Ref = newRef
+		schema.Ref = newRef
 	} else {
 		// A definition from another namespace is being referenced, we have to rewrite that
 		// as a Go import
 
-		schema.SchemaProps.Ref = openapi_spec.Ref{}
+		schema.Ref = openapi_spec.Ref{}
 
 		// This is an interface, we have to set the `x-nullable` extension to not
 		// have invalid Go code being generated by Swagger
 		if isInterface {
-			schema.VendorExtensible.AddExtension("x-nullable", false)
+			schema.AddExtension("x-nullable", false)
 
 			// The type being refereced is an interface. The type is not generated by
 			// swagger because we are replacing it with `json.RawMessage`. This type
@@ -235,9 +238,9 @@ func patchSchemaRef(schema *openapi_spec.Schema,
 			outerObj["import"] = importObj
 			outerObj["type"] = "RawMessage"
 
-			schema.VendorExtensible.AddExtension("x-go-type", outerObj)
+			schema.AddExtension("x-go-type", outerObj)
 		} else {
-			schema.VendorExtensible.AddExtension("x-go-type", propImport.ToMap(gitRepo))
+			schema.AddExtension("x-go-type", propImport.ToMap(gitRepo))
 		}
 	}
 
diff --git a/swagger_helpers/definition_test.go b/swaggerhelpers/definition_test.go
similarity index 95%
rename from swagger_helpers/definition_test.go
rename to swaggerhelpers/definition_test.go
index 0cf7afd..98b3489 100644
--- a/swagger_helpers/definition_test.go
+++ b/swaggerhelpers/definition_test.go
@@ -1,4 +1,4 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	"fmt"
@@ -82,8 +82,8 @@ func TestComputeDependenciesSimpleSchema(t *testing.T) {
 
 	for _, testCase := range cases {
 		properties := make(map[string]openapi_spec.Schema)
-		for counter, refUrl := range testCase.refs {
-			ref, err := openapi_spec.NewRef(refUrl)
+		for counter, refURL := range testCase.refs {
+			ref, err := openapi_spec.NewRef(refURL)
 			if err != nil {
 				t.Errorf("Cannot create ref: %v", err)
 			}
@@ -126,21 +126,21 @@ func TestComputeDependenciesSimpleSchema(t *testing.T) {
 
 func TestComputeDependenciesSchemaWithAdditionalProperties(t *testing.T) {
 	cases := []struct {
-		refUrl       string
+		refURL       string
 		expectedDeps []string
 	}{
 		{
-			refUrl:       "#/definitions/io.k8s.api.admissionregistration.v1.MutatingWebhookSpec",
+			refURL:       "#/definitions/io.k8s.api.admissionregistration.v1.MutatingWebhookSpec",
 			expectedDeps: []string{},
 		},
 		{
-			refUrl:       "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector",
+			refURL:       "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector",
 			expectedDeps: []string{"apimachinery/pkg/apis/meta/v1"},
 		},
 	}
 
 	for _, testCase := range cases {
-		ref, err := openapi_spec.NewRef(testCase.refUrl)
+		ref, err := openapi_spec.NewRef(testCase.refURL)
 		if err != nil {
 			t.Errorf("Cannot create ref: %v", err)
 		}
@@ -192,21 +192,21 @@ func TestComputeDependenciesSchemaWithAdditionalProperties(t *testing.T) {
 
 func TestComputeDependenciesSchemaWithItems(t *testing.T) {
 	cases := []struct {
-		refUrl       string
+		refURL       string
 		expectedDeps []string
 	}{
 		{
-			refUrl:       "#/definitions/io.k8s.api.admissionregistration.v1.MutatingWebhookSpec",
+			refURL:       "#/definitions/io.k8s.api.admissionregistration.v1.MutatingWebhookSpec",
 			expectedDeps: []string{},
 		},
 		{
-			refUrl:       "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector",
+			refURL:       "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector",
 			expectedDeps: []string{"apimachinery/pkg/apis/meta/v1"},
 		},
 	}
 
 	for _, testCase := range cases {
-		ref, err := openapi_spec.NewRef(testCase.refUrl)
+		ref, err := openapi_spec.NewRef(testCase.refURL)
 		if err != nil {
 			t.Errorf("Cannot create ref: %v", err)
 		}
@@ -398,7 +398,7 @@ func TestPatchSchema(t *testing.T) {
 			t.Errorf("cannot find %s property", testCase.PropName)
 			continue
 		}
-		extensions := prop.VendorExtensible.Extensions
+		extensions := prop.Extensions
 		_, found = extensions["x-go-type"]
 		if testCase.XGoTypeIsSet && !found {
 			t.Errorf("x-go-type is not set for %s property", testCase.PropName)
@@ -407,7 +407,7 @@ func TestPatchSchema(t *testing.T) {
 			t.Errorf("x-go-type is was not supposed to be set for %s property", testCase.PropName)
 		}
 
-		ref := prop.SchemaProps.Ref.GetPointer()
+		ref := prop.Ref.GetPointer()
 		refIsNull := ref.IsEmpty()
 		if testCase.RefIsNull && !refIsNull {
 			t.Errorf("%s property should not have a ref set anymore", testCase.PropName)
diff --git a/swagger_helpers/interface_registry.go b/swaggerhelpers/interface_registry.go
similarity index 64%
rename from swagger_helpers/interface_registry.go
rename to swaggerhelpers/interface_registry.go
index 9027132..a478998 100644
--- a/swagger_helpers/interface_registry.go
+++ b/swaggerhelpers/interface_registry.go
@@ -1,14 +1,15 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	"fmt"
+	"log/slog"
 	"strings"
 
 	mapset "github.com/deckarep/golang-set/v2"
 )
 
-// Keeps track of all the `interface` objects that are defined inside of the
-// project
+// InterfaceRegistry keeps track of all the `interface` objects that are
+// defined inside of the project.
 type InterfaceRegistry struct {
 	interfacesByModule map[string]mapset.Set[string]
 }
@@ -19,8 +20,8 @@ func NewInterfaceRegistry() InterfaceRegistry {
 	}
 }
 
-// keep track of the interfaced called `name`, defined inside of the `module`
-// module
+// RegisterInterface keeps track of the interfaced called `name`, defined
+// inside of the `module` module.
 func (r *InterfaceRegistry) RegisterInterface(module, name string) {
 	interfaces, known := r.interfacesByModule[module]
 	if !known {
@@ -31,10 +32,10 @@ func (r *InterfaceRegistry) RegisterInterface(module, name string) {
 	r.interfacesByModule[module] = interfaces
 }
 
-// returns true if this is a known interface, false otherwise
-// * `gitRepo`: repository that will contain the generated code: i.e. `github.com/kubewarden/k8s-objects`
-// * `module`: name of the module where the type is defined
-// * `name`: name of the type
+// IsInterface returns true if this is a known interface, false otherwise.
+// * `gitRepo`: repository that will contain the generated code: i.e. `github.com/kubewarden/k8s-objects`.
+// * `module`: name of the module where the type is defined.
+// * `name`: name of the type.
 func (r *InterfaceRegistry) IsInterface(gitRepo, module, name string) bool {
 	module = strings.TrimPrefix(module, fmt.Sprintf("%s/", gitRepo))
 	interfaces, known := r.interfacesByModule[module]
@@ -48,6 +49,6 @@ func (r *InterfaceRegistry) IsInterface(gitRepo, module, name string) bool {
 
 func (r *InterfaceRegistry) Dump() {
 	for module, interfaces := range r.interfacesByModule {
-		fmt.Printf("interfaces for module %s: %+v\n", module, interfaces)
+		slog.Info("interfaces for module", "module", module, "interfaces", interfaces)
 	}
 }
diff --git a/swagger_helpers/package.go b/swaggerhelpers/package.go
similarity index 85%
rename from swagger_helpers/package.go
rename to swaggerhelpers/package.go
index b49a41e..7af86cf 100644
--- a/swagger_helpers/package.go
+++ b/swaggerhelpers/package.go
@@ -1,4 +1,4 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	mapset "github.com/deckarep/golang-set/v2"
@@ -32,15 +32,15 @@ func (p *Package) AddDefinitionRefactoringPlan(definition *Definition) {
 
 func (p *Package) GenerateSwagger(swaggerVersion, kubernetesVersion, gitRepo string, interfaces *InterfaceRegistry) (openapi_spec.Swagger, error) {
 	swagger := openapi_spec.Swagger{}
-	swagger.SwaggerProps.Swagger = swaggerVersion
+	swagger.Swagger = swaggerVersion
 
 	paths := openapi_spec.Paths{}
-	swagger.SwaggerProps.Paths = &paths
+	swagger.Paths = &paths
 
 	info := openapi_spec.Info{}
-	info.InfoProps.Title = "kubernetes"
-	info.InfoProps.Version = kubernetesVersion
-	swagger.SwaggerProps.Info = &info
+	info.Title = "kubernetes"
+	info.Version = kubernetesVersion
+	swagger.Info = &info
 	swagger.Definitions = make(openapi_spec.Definitions)
 
 	for _, def := range p.Definitions {
diff --git a/swagger_helpers/property_import.go b/swaggerhelpers/property_import.go
similarity index 77%
rename from swagger_helpers/property_import.go
rename to swaggerhelpers/property_import.go
index 46e0964..b9e991e 100644
--- a/swagger_helpers/property_import.go
+++ b/swaggerhelpers/property_import.go
@@ -1,4 +1,4 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	"fmt"
@@ -6,6 +6,7 @@ import (
 	"strings"
 
 	openapi_spec "github.com/go-openapi/spec"
+	"github.com/kubewarden/k8s-objects-generator/common"
 )
 
 type PropertyImport struct {
@@ -18,8 +19,8 @@ func (p *PropertyImport) IsEmpty() bool {
 	return p.PackageName == "" && p.Alias == "" && p.TypeName == ""
 }
 
-// Convert PropertyImport into a swagger x-go-type interface
-// * `gitRepo`: name of the repository that is going to host the code, e.g. `github.com/kubewarden/k8s-objects`
+// ToMap converts PropertyImport into a swagger x-go-type interface.
+// * `gitRepo`: name of the repository that is going to host the code, e.g. `github.com/kubewarden/k8s-objects`.
 func (p *PropertyImport) ToMap(gitRepo string) map[string]interface{} {
 	outerObj := make(map[string]interface{})
 
@@ -35,14 +36,16 @@ func (p *PropertyImport) ToMap(gitRepo string) map[string]interface{} {
 	return outerObj
 }
 
+// NewPropertyImportFromRef returns a propertImport from a Ref.
 // Given a `ref` string like:
 // `/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector`
 // return:
-//  `propertyImport"{
-//      package_name: "apimachinery/pkg/apis/meta/v1",
-//      alias: "apimachinery_pkgs_apis_meta_v1",
-//      type_name: "LabelSelector",
-//  }
+//
+//	propertyImport"{
+//	   package_name: "apimachinery/pkg/apis/meta/v1",
+//	   alias: "apimachinery_pkgs_apis_meta_v1",
+//	   type_name: "LabelSelector",
+//	}
 func NewPropertyImportFromRef(ref *openapi_spec.Ref) (PropertyImport, error) {
 	refPointer := ref.GetPointer()
 	if refPointer == nil || refPointer.IsEmpty() {
@@ -51,7 +54,7 @@ func NewPropertyImportFromRef(ref *openapi_spec.Ref) (PropertyImport, error) {
 
 	namespace := strings.TrimPrefix(refPointer.String(), "/definitions/io.k8s.")
 	chunks := strings.Split(namespace, ".")
-	if len(chunks) < 2 {
+	if len(chunks) < common.ChunkNumber {
 		return PropertyImport{},
 			fmt.Errorf("ref -> chunk: not enough chunks for %s: %+v", ref, chunks)
 	}
diff --git a/swagger_helpers/property_import_test.go b/swaggerhelpers/property_import_test.go
similarity index 99%
rename from swagger_helpers/property_import_test.go
rename to swaggerhelpers/property_import_test.go
index 4858266..492bc06 100644
--- a/swagger_helpers/property_import_test.go
+++ b/swaggerhelpers/property_import_test.go
@@ -1,4 +1,4 @@
-package swagger_helpers
+package swaggerhelpers
 
 import (
 	"fmt"
diff --git a/templates.go b/templates.go
index ee73462..427f9d0 100644
--- a/templates.go
+++ b/templates.go
@@ -19,38 +19,38 @@ func writeTemplates(destinationRoot string) error {
 		return errors.Wrapf(err, "cannot remove directory %s", destinationRoot)
 	}
 
-	walkDirFn := func(path string, d os.DirEntry, err error) (e error) {
+	walkDirFn := func(path string, d os.DirEntry, walkErr error) error {
 		if path == "." {
 			return nil
 		}
 
 		if d.IsDir() {
-			err := os.MkdirAll(filepath.Join(destinationRoot, path), 0777)
-			if err != nil && !os.IsExist(err) {
-				return err
-			}
-		} else {
-			src, err := templatesFS.Open(path)
-			if err != nil {
-				return errors.Wrapf(err, "Cannot open embedded file %s for reading", path)
-			}
-			dstFileName := filepath.Join(destinationRoot, path)
-			dst, err := os.Create(dstFileName)
-			if err != nil {
-				return errors.Wrapf(err, "Cannot open %s for writing contents of %s",
-					dstFileName, path)
-			}
-			_, err = io.Copy(dst, src)
-			if err != nil {
-				return errors.Wrapf(err, "Cannot copy %s contents to %s",
-					path, dstFileName)
+			err2 := os.MkdirAll(filepath.Join(destinationRoot, path), 0o750)
+			if err2 != nil && !os.IsExist(err2) {
+				return err2
 			}
+			return nil
+		}
+		src, err := templatesFS.Open(path)
+		if err != nil {
+			return errors.Wrapf(err, "Cannot open embedded file %s for reading", path)
+		}
+		defer src.Close()
 
-			if err := dst.Close(); err != nil {
-				return errors.Wrapf(err, "error closing file %s", dstFileName)
-			}
-			_ = src.Close()
+		dstFileName := filepath.Join(destinationRoot, path)
+		dst, err := os.Create(dstFileName)
+		if err != nil {
+			return errors.Wrapf(err, "Cannot open %s for writing contents of %s",
+				dstFileName, path)
 		}
+		defer dst.Close()
+
+		_, err = io.Copy(dst, src)
+		if err != nil {
+			return errors.Wrapf(err, "Cannot copy %s contents to %s",
+				path, dstFileName)
+		}
+
 		return nil
 	}
 	if err := fs.WalkDir(templatesFS, ".", walkDirFn); err != nil {


Reviews:
user: login: fabriziosestito
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T05:33:33Z
user: login: fabriziosestito
body: I've noticed we are not using the golden config for this project. I think this is the occasion to start using it, we could use the one of policy-sdk-go as a starting point: https://github.com/kubewarden/policy-sdk-go/blob/main/.golangci.yml
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T05:36:38Z
user: login: fabriziosestito
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T14:26:42Z
user: login: fabriziosestito
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T14:26:58Z
user: login: viccuad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-22T15:05:41Z
user: login: viccuad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-22T15:05:43Z
user: login: fabriziosestito
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T15:10:48Z
user: login: jvanz
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-22T17:09:41Z

Review comments:
diff_hunk: @@ -0,0 +1,469 @@
+# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
+# Copyright (c) 2021-2025 Marat Reymers
+
+## Golden config for golangci-lint v2.0.2
+#
+# This is the best config for golangci-lint based on my experience and opinion.
+# It is very strict, but not extremely strict.
+# Feel free to adapt it to suit your needs.
+# If this config helps you, please consider keeping a link to this file (see the next comment).
+
+# Based on https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+
+version: "2"
+
+issues:
+  # Maximum count of issues with the same text.
+  # Set to 0 to disable.
+  # Default: 3
+  max-same-issues: 50
+
+formatters:
+  enable:
+    - goimports # checks if the code and import statements are formatted according to the 'goimports' command
+
+    ## you may want to enable
+    #- gci # checks if code and import statements are formatted, with additional rules
+    #- gofmt # checks if the code is formatted according to 'gofmt' command
+
+    ## disabled
+    #- gofumpt # [replaced by goimports, gofumports is not available yet] checks if code and import statements are formatted, with additional rules
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    goimports:
+      # A list of prefixes, which, if set, checks import paths
+      # with the given prefixes are grouped after 3rd-party packages.
+      # Default: []
+      local-prefixes:
+        - github.com/my/project
+
+    golines:
+      # Target maximum line length.
+      # Default: 100
+      max-len: 120
+
+linters:
+  enable:
+    - asasalint # checks for pass []any as any in variadic func(...any)
+    - asciicheck # checks that your code does not contain non-ASCII identifiers
+    - bidichk # checks for dangerous unicode character sequences
+    - bodyclose # checks whether HTTP response body is closed successfully
+    - canonicalheader # checks whether net/http.Header uses canonical header
+    - copyloopvar # detects places where loop variables are copied (Go 1.22+)
+    - cyclop # checks function and package cyclomatic complexity
+    - depguard # checks if package imports are in a list of acceptable packages
+    - dupl # tool for code clone detection
+    - durationcheck # checks for two durations multiplied together
+    - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
+    - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
+    - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
+    - exhaustive # checks exhaustiveness of enum switch statements
+    - exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
+    - fatcontext # detects nested contexts in loops
+    - forbidigo # forbids identifiers
+    - funlen # tool for detection of long functions
+    - gocheckcompilerdirectives # validates go compiler directive comments (//go:)
+    - gochecknoglobals # checks that no global variables exist
+    - gochecknoinits # checks that no init functions are present in Go code
+    - gochecksumtype # checks exhaustiveness on Go "sum types"
+    - gocognit # computes and checks the cognitive complexity of functions
+    - goconst # finds repeated strings that could be replaced by a constant
+    - gocritic # provides diagnostics that check for bugs, performance and style issues
+    - gocyclo # computes and checks the cyclomatic complexity of functions
+    - godot # checks if comments end in a period
+    - goprintffuncname # checks that printf-like functions are named with f at the end
+    - gosec # inspects source code for security problems
+    - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
+    - iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
+    - ineffassign # detects when assignments to existing variables are not used
+    - intrange # finds places where for loops could make use of an integer range
+    - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
+    - makezero # finds slice declarations with non-zero initial length
+    - mirror # reports wrong mirror patterns of bytes/strings usage
+    - mnd # detects magic numbers
+    - musttag # enforces field tags in (un)marshaled structs
+    - nakedret # finds naked returns in functions greater than a specified function length
+    - nestif # reports deeply nested if statements
+    - nilerr # finds the code that returns nil even if it checks that the error is not nil
+    - nilnesserr # reports that it checks for err != nil, but it returns a different nil value error (powered by nilness and nilerr)
+    - nilnil # checks that there is no simultaneous return of nil error and an invalid value
+    - noctx # finds sending http request without context.Context
+    - nolintlint # reports ill-formed or insufficient nolint directives
+    - nonamedreturns # reports all named returns
+    - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
+    - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative
+    - predeclared # finds code that shadows one of Go's predeclared identifiers
+    - promlinter # checks Prometheus metrics naming via promlint
+    - protogetter # reports direct reads from proto message fields when getters should be used
+    - reassign # checks that package variables are not reassigned
+    - recvcheck # checks for receiver type consistency
+    - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
+    - rowserrcheck # checks whether Err of rows is checked successfully
+    - sloglint # ensure consistent code style when using log/slog
+    - spancheck # checks for mistakes with OpenTelemetry/Census spans
+    - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
+    - staticcheck # is a go vet on steroids, applying a ton of static analysis checks
+    - testableexamples # checks if examples are testable (have an expected output)
+    - testifylint # checks usage of github.com/stretchr/testify
+    - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
+    - unconvert # removes unnecessary type conversions
+    - unparam # reports unused function parameters
+    - unused # checks for unused constants, variables, functions and types
+    - usestdlibvars # detects the possibility to use variables/constants from the Go standard library
+    - usetesting # reports uses of functions with replacement inside the testing package
+    - wastedassign # finds wasted assignment statements
+    - whitespace # detects leading and trailing whitespace
+
+    ## you may want to enable
+    #- decorder # checks declaration order and count of types, constants, variables and functions
+    #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized
+    #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
+    #- godox # detects usage of FIXME, TODO and other keywords inside comments
+    #- goheader # checks is file header matches to pattern
+    #- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters
+    #- interfacebloat # checks the number of methods inside an interface
+    #- ireturn # accept interfaces, return concrete types
+    #- prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated
+    #- tagalign # checks that struct tags are well aligned
+    #- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope
+    #- wrapcheck # checks that errors returned from external packages are wrapped
+    #- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event
+
+    ## disabled
+    #- containedctx # detects struct contained context.Context field
+    #- contextcheck # [too many false positives] checks the function whether use a non-inherited context
+    #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
+    #- dupword # [useless without config] checks for duplicate words in the source code
+    #- err113 # [too strict] checks the errors handling expressions
+    #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
+    #- forcetypeassert # [replaced by errcheck] finds forced type assertions
+    #- gomodguard # [use more powerful depguard] allow and block lists linter for direct Go module dependencies
+    #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase
+    #- grouper # analyzes expression groups
+    #- importas # enforces consistent import aliases
+    #- lll # [replaced by golines] reports long lines
+    #- maintidx # measures the maintainability index of each function
+    #- misspell # [useless] finds commonly misspelled English words in comments
+    #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
+    #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
+    #- tagliatelle # checks the struct tags
+    #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
+    #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
+
+    ############################################################################
+    # Kubewarden linter customization
+    # The following linters are disabled because they does not make sense for
+    # the Kubewarden
+    ############################################################################
+
+    # We disable the testpackage linter because we have tests which is not
+    # black boxed and that will not cause issues for us for now.
+    # - testpackage # makes you use a separate _test package
+
+    # We use replace directives in go.mod to replace some dependencies to use
+    # our forked or stripped versions.
+    # - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
+
+    # We have a bunch of places where the function argument list are long.
+    # - golines
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    cyclop:
+      # The maximal code complexity to report.
+      # Default: 10
+      max-complexity: 30
+      # The maximal average package complexity.
+      # If it's higher than 0.0 (float) the check is enabled
+      # Default: 0.0
+      package-average: 10.0
+
+    depguard:
+      # Rules to apply.
+      #
+      # Variables:
+      # - File Variables
+      #   Use an exclamation mark `!` to negate a variable.
+      #   Example: `!$test` matches any file that is not a go test file.
+      #
+      #   `$all` - matches all go files
+      #   `$test` - matches all go test files
+      #
+      # - Package Variables
+      #
+      #   `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
+      #
+      # Default (applies if no custom rules are defined): Only allow $gostd in all files.
+      rules:
+        "deprecated":
+          # List of file globs that will match this list of settings to compare against.
+          # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
+          # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
+          # Default: $all
+          files:
+            - "$all"
+          # List of packages that are not allowed.
+          # Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).
+          # Default: []
+          deny:
+            - pkg: github.com/golang/protobuf
+              desc: Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules
+            - pkg: github.com/satori/go.uuid
+              desc: Use github.com/google/uuid instead, satori's package is not maintained
+            - pkg: github.com/gofrs/uuid$
+              desc: Use github.com/gofrs/uuid/v5 or later, it was not a go module before v5
+        "non-test files":
+          files:
+            - "!$test"
+          deny:
+            - pkg: math/rand$
+              desc: Use math/rand/v2 instead, see https://go.dev/blog/randv2
+        "non-main files":
+          files:
+            - "!**/main.go"
+          deny:
+            - pkg: log$
+              desc: Use log/slog instead, see https://go.dev/blog/slog
+
+    errcheck:
+      # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+      # Such cases aren't reported by default.
+      # Default: false
+      check-type-assertions: true
+
+    exhaustive:
+      # Program elements to check for exhaustiveness.
+      # Default: [ switch ]
+      check:
+        - switch
+        - map
+
+    exhaustruct:
+      # List of regular expressions to exclude struct packages and their names from checks.
+      # Regular expressions must match complete canonical struct package/name/structname.
+      # Default: []
+      exclude:
+        # std libs
+        - ^net/http.Client$
+        - ^net/http.Cookie$
+        - ^net/http.Request$
+        - ^net/http.Response$
+        - ^net/http.Server$
+        - ^net/http.Transport$
+        - ^net/url.URL$
+        - ^os/exec.Cmd$
+        - ^reflect.StructField$
+        # public libs
+        - ^github.com/Shopify/sarama.Config$
+        - ^github.com/Shopify/sarama.ProducerMessage$
+        - ^github.com/mitchellh/mapstructure.DecoderConfig$
+        - ^github.com/prometheus/client_golang/.+Opts$
+        - ^github.com/spf13/cobra.Command$
+        - ^github.com/spf13/cobra.CompletionOptions$
+        - ^github.com/stretchr/testify/mock.Mock$
+        - ^github.com/testcontainers/testcontainers-go.+Request$
+        - ^github.com/testcontainers/testcontainers-go.FromDockerfile$
+        - ^golang.org/x/tools/go/analysis.Analyzer$
+        - ^google.golang.org/protobuf/.+Options$
+        - ^gopkg.in/yaml.v3.Node$
+
+    funlen:
+      # Checks the number of lines in a function.
+      # If lower than 0, disable the check.
+      # Default: 60
+      lines: 100
+      # Checks the number of statements in a function.
+      # If lower than 0, disable the check.
+      # Default: 40
+      statements: 50
+
+    gochecksumtype:
+      # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
+      # Default: true
+      default-signifies-exhaustive: false
+
+    gocognit:
+      # Minimal code complexity to report.
+      # Default: 30 (but we recommend 10-20)
+      min-complexity: 20
+
+    gocritic:
+      # Settings passed to gocritic.
+      # The settings key is the name of a supported gocritic checker.
+      # The list of supported checkers can be find in https://go-critic.github.io/overview.
+      settings:
+        captLocal:
+          # Whether to restrict checker to params only.
+          # Default: true
+          paramsOnly: false
+        underef:
+          # Whether to skip (*x).method() calls where x is a pointer receiver.
+          # Default: true
+          skipRecvDeref: false
+
+    govet:
+      # Enable all analyzers.
+      # Default: false
+      enable-all: true
+      # Disable analyzers by name.
+      # Run `go tool vet help` to see all analyzers.
+      # Default: []
+      disable:
+        - fieldalignment # too strict
+      # Settings per analyzer.
+      settings:
+        shadow:
+          # Whether to be strict about shadowing; can be noisy.
+          # Default: false
+          strict: true
path: .golangci.yml
user: login: fabriziosestito
body: change to false
created_at: 2025-04-22T14:26:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,9 +43,9 @@ func main() {
 		}
 	}
 	if swaggerFile != "" {
-		data, err := os.ReadFile(swaggerFile)
-		if err != nil {
-			log.Fatalf("cannot read swagger file %s: %v", swaggerFile, err)
+		data, err2 := os.ReadFile(swaggerFile)
path: main.go
user: login: fabriziosestito
body: We can disable the strictness of [this](https://github.com/kubewarden/k8s-objects-generator/pull/77/commits/ceb4b7e43c2d7b0e9fe92c1b007051c606861558#r2054240633) lint by changing this to false.
The rationale is that we don't need to be strict, and it is ok to shadow an error. 
After that, we can drop this commit.

created_at: 2025-04-22T14:26:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,469 @@
+# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
+# Copyright (c) 2021-2025 Marat Reymers
+
+## Golden config for golangci-lint v2.0.2
+#
+# This is the best config for golangci-lint based on my experience and opinion.
+# It is very strict, but not extremely strict.
+# Feel free to adapt it to suit your needs.
+# If this config helps you, please consider keeping a link to this file (see the next comment).
+
+# Based on https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
+
+version: "2"
+
+issues:
+  # Maximum count of issues with the same text.
+  # Set to 0 to disable.
+  # Default: 3
+  max-same-issues: 50
+
+formatters:
+  enable:
+    - goimports # checks if the code and import statements are formatted according to the 'goimports' command
+
+    ## you may want to enable
+    #- gci # checks if code and import statements are formatted, with additional rules
+    #- gofmt # checks if the code is formatted according to 'gofmt' command
+
+    ## disabled
+    #- gofumpt # [replaced by goimports, gofumports is not available yet] checks if code and import statements are formatted, with additional rules
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    goimports:
+      # A list of prefixes, which, if set, checks import paths
+      # with the given prefixes are grouped after 3rd-party packages.
+      # Default: []
+      local-prefixes:
+        - github.com/my/project
+
+    golines:
+      # Target maximum line length.
+      # Default: 100
+      max-len: 120
+
+linters:
+  enable:
+    - asasalint # checks for pass []any as any in variadic func(...any)
+    - asciicheck # checks that your code does not contain non-ASCII identifiers
+    - bidichk # checks for dangerous unicode character sequences
+    - bodyclose # checks whether HTTP response body is closed successfully
+    - canonicalheader # checks whether net/http.Header uses canonical header
+    - copyloopvar # detects places where loop variables are copied (Go 1.22+)
+    - cyclop # checks function and package cyclomatic complexity
+    - depguard # checks if package imports are in a list of acceptable packages
+    - dupl # tool for code clone detection
+    - durationcheck # checks for two durations multiplied together
+    - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases
+    - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
+    - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
+    - exhaustive # checks exhaustiveness of enum switch statements
+    - exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
+    - fatcontext # detects nested contexts in loops
+    - forbidigo # forbids identifiers
+    - funlen # tool for detection of long functions
+    - gocheckcompilerdirectives # validates go compiler directive comments (//go:)
+    - gochecknoglobals # checks that no global variables exist
+    - gochecknoinits # checks that no init functions are present in Go code
+    - gochecksumtype # checks exhaustiveness on Go "sum types"
+    - gocognit # computes and checks the cognitive complexity of functions
+    - goconst # finds repeated strings that could be replaced by a constant
+    - gocritic # provides diagnostics that check for bugs, performance and style issues
+    - gocyclo # computes and checks the cyclomatic complexity of functions
+    - godot # checks if comments end in a period
+    - goprintffuncname # checks that printf-like functions are named with f at the end
+    - gosec # inspects source code for security problems
+    - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
+    - iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
+    - ineffassign # detects when assignments to existing variables are not used
+    - intrange # finds places where for loops could make use of an integer range
+    - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
+    - makezero # finds slice declarations with non-zero initial length
+    - mirror # reports wrong mirror patterns of bytes/strings usage
+    - mnd # detects magic numbers
+    - musttag # enforces field tags in (un)marshaled structs
+    - nakedret # finds naked returns in functions greater than a specified function length
+    - nestif # reports deeply nested if statements
+    - nilerr # finds the code that returns nil even if it checks that the error is not nil
+    - nilnesserr # reports that it checks for err != nil, but it returns a different nil value error (powered by nilness and nilerr)
+    - nilnil # checks that there is no simultaneous return of nil error and an invalid value
+    - noctx # finds sending http request without context.Context
+    - nolintlint # reports ill-formed or insufficient nolint directives
+    - nonamedreturns # reports all named returns
+    - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL
+    - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative
+    - predeclared # finds code that shadows one of Go's predeclared identifiers
+    - promlinter # checks Prometheus metrics naming via promlint
+    - protogetter # reports direct reads from proto message fields when getters should be used
+    - reassign # checks that package variables are not reassigned
+    - recvcheck # checks for receiver type consistency
+    - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
+    - rowserrcheck # checks whether Err of rows is checked successfully
+    - sloglint # ensure consistent code style when using log/slog
+    - spancheck # checks for mistakes with OpenTelemetry/Census spans
+    - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
+    - staticcheck # is a go vet on steroids, applying a ton of static analysis checks
+    - testableexamples # checks if examples are testable (have an expected output)
+    - testifylint # checks usage of github.com/stretchr/testify
+    - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
+    - unconvert # removes unnecessary type conversions
+    - unparam # reports unused function parameters
+    - unused # checks for unused constants, variables, functions and types
+    - usestdlibvars # detects the possibility to use variables/constants from the Go standard library
+    - usetesting # reports uses of functions with replacement inside the testing package
+    - wastedassign # finds wasted assignment statements
+    - whitespace # detects leading and trailing whitespace
+
+    ## you may want to enable
+    #- decorder # checks declaration order and count of types, constants, variables and functions
+    #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized
+    #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
+    #- godox # detects usage of FIXME, TODO and other keywords inside comments
+    #- goheader # checks is file header matches to pattern
+    #- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters
+    #- interfacebloat # checks the number of methods inside an interface
+    #- ireturn # accept interfaces, return concrete types
+    #- prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated
+    #- tagalign # checks that struct tags are well aligned
+    #- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope
+    #- wrapcheck # checks that errors returned from external packages are wrapped
+    #- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event
+
+    ## disabled
+    #- containedctx # detects struct contained context.Context field
+    #- contextcheck # [too many false positives] checks the function whether use a non-inherited context
+    #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
+    #- dupword # [useless without config] checks for duplicate words in the source code
+    #- err113 # [too strict] checks the errors handling expressions
+    #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
+    #- forcetypeassert # [replaced by errcheck] finds forced type assertions
+    #- gomodguard # [use more powerful depguard] allow and block lists linter for direct Go module dependencies
+    #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase
+    #- grouper # analyzes expression groups
+    #- importas # enforces consistent import aliases
+    #- lll # [replaced by golines] reports long lines
+    #- maintidx # measures the maintainability index of each function
+    #- misspell # [useless] finds commonly misspelled English words in comments
+    #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
+    #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
+    #- tagliatelle # checks the struct tags
+    #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
+    #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
+
+    ############################################################################
+    # Kubewarden linter customization
+    # The following linters are disabled because they does not make sense for
+    # the Kubewarden
+    ############################################################################
+
+    # We disable the testpackage linter because we have tests which is not
+    # black boxed and that will not cause issues for us for now.
+    # - testpackage # makes you use a separate _test package
+
+    # We use replace directives in go.mod to replace some dependencies to use
+    # our forked or stripped versions.
+    # - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
+
+    # We have a bunch of places where the function argument list are long.
+    # - golines
+
+  # All settings can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
+  settings:
+    cyclop:
+      # The maximal code complexity to report.
+      # Default: 10
+      max-complexity: 30
+      # The maximal average package complexity.
+      # If it's higher than 0.0 (float) the check is enabled
+      # Default: 0.0
+      package-average: 10.0
+
+    depguard:
+      # Rules to apply.
+      #
+      # Variables:
+      # - File Variables
+      #   Use an exclamation mark `!` to negate a variable.
+      #   Example: `!$test` matches any file that is not a go test file.
+      #
+      #   `$all` - matches all go files
+      #   `$test` - matches all go test files
+      #
+      # - Package Variables
+      #
+      #   `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
+      #
+      # Default (applies if no custom rules are defined): Only allow $gostd in all files.
+      rules:
+        "deprecated":
+          # List of file globs that will match this list of settings to compare against.
+          # By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
+          # The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
+          # Default: $all
+          files:
+            - "$all"
+          # List of packages that are not allowed.
+          # Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).
+          # Default: []
+          deny:
+            - pkg: github.com/golang/protobuf
+              desc: Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules
+            - pkg: github.com/satori/go.uuid
+              desc: Use github.com/google/uuid instead, satori's package is not maintained
+            - pkg: github.com/gofrs/uuid$
+              desc: Use github.com/gofrs/uuid/v5 or later, it was not a go module before v5
+        "non-test files":
+          files:
+            - "!$test"
+          deny:
+            - pkg: math/rand$
+              desc: Use math/rand/v2 instead, see https://go.dev/blog/randv2
+        "non-main files":
+          files:
+            - "!**/main.go"
+          deny:
+            - pkg: log$
+              desc: Use log/slog instead, see https://go.dev/blog/slog
+
+    errcheck:
+      # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
+      # Such cases aren't reported by default.
+      # Default: false
+      check-type-assertions: true
+
+    exhaustive:
+      # Program elements to check for exhaustiveness.
+      # Default: [ switch ]
+      check:
+        - switch
+        - map
+
+    exhaustruct:
+      # List of regular expressions to exclude struct packages and their names from checks.
+      # Regular expressions must match complete canonical struct package/name/structname.
+      # Default: []
+      exclude:
+        # std libs
+        - ^net/http.Client$
+        - ^net/http.Cookie$
+        - ^net/http.Request$
+        - ^net/http.Response$
+        - ^net/http.Server$
+        - ^net/http.Transport$
+        - ^net/url.URL$
+        - ^os/exec.Cmd$
+        - ^reflect.StructField$
+        # public libs
+        - ^github.com/Shopify/sarama.Config$
+        - ^github.com/Shopify/sarama.ProducerMessage$
+        - ^github.com/mitchellh/mapstructure.DecoderConfig$
+        - ^github.com/prometheus/client_golang/.+Opts$
+        - ^github.com/spf13/cobra.Command$
+        - ^github.com/spf13/cobra.CompletionOptions$
+        - ^github.com/stretchr/testify/mock.Mock$
+        - ^github.com/testcontainers/testcontainers-go.+Request$
+        - ^github.com/testcontainers/testcontainers-go.FromDockerfile$
+        - ^golang.org/x/tools/go/analysis.Analyzer$
+        - ^google.golang.org/protobuf/.+Options$
+        - ^gopkg.in/yaml.v3.Node$
+
+    funlen:
+      # Checks the number of lines in a function.
+      # If lower than 0, disable the check.
+      # Default: 60
+      lines: 100
+      # Checks the number of statements in a function.
+      # If lower than 0, disable the check.
+      # Default: 40
+      statements: 50
+
+    gochecksumtype:
+      # Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
+      # Default: true
+      default-signifies-exhaustive: false
+
+    gocognit:
+      # Minimal code complexity to report.
+      # Default: 30 (but we recommend 10-20)
+      min-complexity: 20
+
+    gocritic:
+      # Settings passed to gocritic.
+      # The settings key is the name of a supported gocritic checker.
+      # The list of supported checkers can be find in https://go-critic.github.io/overview.
+      settings:
+        captLocal:
+          # Whether to restrict checker to params only.
+          # Default: true
+          paramsOnly: false
+        underef:
+          # Whether to skip (*x).method() calls where x is a pointer receiver.
+          # Default: true
+          skipRecvDeref: false
+
+    govet:
+      # Enable all analyzers.
+      # Default: false
+      enable-all: true
+      # Disable analyzers by name.
+      # Run `go tool vet help` to see all analyzers.
+      # Default: []
+      disable:
+        - fieldalignment # too strict
+      # Settings per analyzer.
+      settings:
+        shadow:
+          # Whether to be strict about shadowing; can be noisy.
+          # Default: false
+          strict: true
path: .golangci.yml
user: login: viccuad
body: Done.
created_at: 2025-04-22T15:05:41Z
author_association: MEMBER
diff_hunk: @@ -43,9 +43,9 @@ func main() {
 		}
 	}
 	if swaggerFile != "" {
-		data, err := os.ReadFile(swaggerFile)
-		if err != nil {
-			log.Fatalf("cannot read swagger file %s: %v", swaggerFile, err)
+		data, err2 := os.ReadFile(swaggerFile)
path: main.go
user: login: viccuad
body: Done, rebased.
created_at: 2025-04-22T15:05:42Z
author_association: MEMBER

PR comments:
user: login: renovate[bot]
created_at: 2025-04-07T11:33:55Z
body: ### Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

 ⚠️ **Warning**: custom changes will be lost.
author_association: CONTRIBUTOR
user: login: flavio
created_at: 2025-04-07T12:24:54Z
body: We need to update the golangci linter configuration to v2 format
author_association: MEMBER
user: login: viccuad
created_at: 2025-04-08T08:02:56Z
body: 78 new issues.. will move to in progress.
author_association: MEMBER