0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-29 18:21:10 +00:00

chore(deps): Update golangci/golangci-lint (v1.64.8 → v2.0.2) (#1847)

* chore(deps): Update golangci/golangci-lint (v1.64.8 → v2.0.2)

| datasource      | package                | from    | to     |
| --------------- | ---------------------- | ------- | ------ |
| github-releases | golangci/golangci-lint | v1.64.8 | v2.0.2 |

* migrate linter config

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2025-03-26 10:56:36 -04:00 committed by GitHub
parent 2ae77257d3
commit 1eee8cdbd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 104 additions and 107 deletions

View File

@ -40,7 +40,7 @@ jobs:
- name: Lint code
if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}}
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6
uses: golangci/golangci-lint-action@v7
with:
version: v1.64.8 # renovate: depName=golangci/golangci-lint datasource=github-releases
version: v2.0.2 # renovate: depName=golangci/golangci-lint datasource=github-releases
args: -v --timeout=10m

View File

@ -1,88 +1,97 @@
issues:
new-from-rev: 9101977dc81f64db077b9a1eda2fe401359854c9
# Maximum issues count per one linter. Set to 0 to disable.
# Default is 50.
max-issues-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable.
# Default is 3.
max-same-issues: 0
include:
- EXC0012
- EXC0014
exclude-rules:
# Exclude some checks in tests
- path: _(test|gen)\.go
linters:
- cyclop
- dupl
- funlen
- gocognit
- gosec
- lll
- path: .*/types/.+\.go
linters:
# types have both pointer and value receivers due to JSON marshalling
- recvcheck
- path: _types\.go
linters:
- recvcheck
- lll
- path: fwprovider/.*_test\.go
linters:
- paralleltest
# Exclude `lll` issues for long lines with URLs.
- linters:
- lll
source: "^.*https?://.*$"
linters-settings:
exhaustive:
default-signifies-exhaustive: true
cyclop:
max-complexity: 25
dupl:
threshold: 150
goconst:
min-len: 10
min-occurrences: 4
gosec:
excludes:
- G115
funlen:
lines: 80
statements: 60
errcheck:
check-blank: true
wrapcheck:
ignorePackageGlobs:
# Prevent false-positive matches for errors from packages of the own module.
- github.com/bpg/terraform-provider-proxmox/*
version: "2"
linters:
enable-all: true
default: all
disable:
# deprecated
- gocyclo
- rowserrcheck
- tenv
- wastedassign
# require massive refactoring
- canonicalheader
- cyclop
- depguard
- err113
- exhaustruct
- forcetypeassert
- funlen
- gocognit
# others
- canonicalheader
- depguard
- exhaustruct
- gci
- err113
- gocyclo
- ireturn
- maintidx
- mnd
- nestif
- nlreturn
- perfsprint
- rowserrcheck
- tagliatelle
- testpackage
- tparallel
- varnamelen
fast: false
- wastedassign
settings:
cyclop:
max-complexity: 25
dupl:
threshold: 150
errcheck:
check-blank: true
exhaustive:
default-signifies-exhaustive: true
funlen:
lines: 80
statements: 60
goconst:
min-len: 10
min-occurrences: 4
gosec:
excludes:
- G115
revive:
rules:
- name: "package-comments"
disabled: true
wrapcheck:
ignore-package-globs:
- github.com/bpg/terraform-provider-proxmox/*
exclusions:
generated: lax
presets:
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- cyclop
- dupl
- funlen
- gocognit
- gosec
- lll
path: _(test|gen)\.go
- linters:
- recvcheck
path: .*/types/.+\.go
- linters:
- lll
- recvcheck
path: _types\.go
- linters:
- paralleltest
path: fwprovider/.*_test\.go
- linters:
- lll
source: ^.*https?://.*$
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
new-from-rev: 9101977dc81f64db077b9a1eda2fe401359854c9
formatters:
enable:
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@ -33,7 +33,6 @@
"FSTRIM",
"fwprovider",
"gocritic",
"gosimple",
"hookscript",
"hostnodes",
"hostpci",

View File

@ -3,7 +3,7 @@ TARGETS=darwin linux windows
TERRAFORM_PLUGIN_EXTENSION=
VERSION=0.73.2# x-release-please-version
GOLANGCI_LINT_VERSION=v1.64.8# renovate: depName=golangci/golangci-lint datasource=github-releases
GOLANGCI_LINT_VERSION=v2.0.2# renovate: depName=golangci/golangci-lint datasource=github-releases
# check if opentofu is installed and use it if it is,
# otherwise use terraform
@ -111,8 +111,8 @@ testacc:
.PHONY: lint
lint:
# NOTE: This target runs only locally, not in CI. See .github/workflows/golangci-lint.yml for CI linting.
@docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run --fix
# NOTE: This target is for local runs only. For linting in CI see .github/workflows/golangci-lint.yml
@docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/$(GOLANGCI_LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint format run --fix
.PHONY: release-build
release-build:

View File

@ -1395,8 +1395,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
template := types.CustomBool(d.Get(mkTemplate).(bool))
//nolint:gosimple
if template != dvTemplate {
if template {
updateBody.Template = &template
}
@ -1605,7 +1604,7 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
mountPointArray := make(containers.CustomMountPointArray, 0, len(mountPoint))
// because of default bool values:
//nolint:gosimple
for _, mp := range mountPoint {
mountPointMap := mp.(map[string]interface{})
mountPointObject := containers.CustomMountPoint{}
@ -1622,11 +1621,11 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
volume := mountPointMap[mkMountPointVolume].(string)
// we have to set only the values that are different from the provider's defaults,
if acl != dvMountPointACL {
if acl {
mountPointObject.ACL = &acl
}
if backup != dvMountPointBackup {
if backup {
mountPointObject.Backup = &backup
}
@ -1634,19 +1633,19 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
mountPointObject.MountPoint = path
}
if quota != dvMountPointQuota {
if quota {
mountPointObject.Quota = &quota
}
if readOnly != dvMountPointReadOnly {
if readOnly {
mountPointObject.ReadOnly = &readOnly
}
if replicate != dvMountPointReplicate {
if !replicate {
mountPointObject.Replicate = &replicate
}
if shared != dvMountPointShared {
if shared {
mountPointObject.Shared = &shared
}
@ -2746,8 +2745,7 @@ func containerRead(ctx context.Context, d *schema.ResourceData, m interface{}) d
currentProtection := types.CustomBool(d.Get(mkProtection).(bool))
//nolint:gosimple
if len(clone) == 0 || currentProtection != dvProtection {
if len(clone) == 0 || currentProtection {
if containerConfig.Protection != nil {
e = d.Set(
mkProtection,
@ -2782,8 +2780,7 @@ func containerRead(ctx context.Context, d *schema.ResourceData, m interface{}) d
currentTemplate := d.Get(mkTemplate).(bool)
//nolint:gosimple
if len(clone) == 0 || currentTemplate != dvTemplate {
if len(clone) == 0 || currentTemplate {
if containerConfig.Template != nil {
e = d.Set(
mkTemplate,

View File

@ -1923,8 +1923,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
var del []string
//nolint:gosimple
if acpi != dvACPI {
if !acpi {
updateBody.ACPI = &acpi
}
@ -2144,13 +2143,11 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
updateBody.StartupOrder = vmGetStartupOrder(d)
//nolint:gosimple
if tabletDevice != dvTabletDevice {
if !tabletDevice {
updateBody.TabletDeviceEnabled = &tabletDevice
}
//nolint:gosimple
if protection != dvProtection {
if protection {
updateBody.DeletionProtection = &protection
}
@ -2159,8 +2156,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
updateBody.Tags = &tagString
}
//nolint:gosimple
if template != dvTemplate {
if template {
updateBody.Template = &template
}
@ -4587,8 +4583,7 @@ func vmReadPrimitiveValues(
clone := d.Get(mkClone).([]interface{})
currentACPI := d.Get(mkACPI).(bool)
//nolint:gosimple
if len(clone) == 0 || currentACPI != dvACPI {
if len(clone) == 0 || !currentACPI {
if vmConfig.ACPI != nil {
err = d.Set(mkACPI, bool(*vmConfig.ACPI))
} else {
@ -4699,8 +4694,7 @@ func vmReadPrimitiveValues(
currentProtection := d.Get(mkProtection).(bool)
//nolint:gosimple
if len(clone) == 0 || currentProtection != dvProtection {
if len(clone) == 0 || currentProtection {
if vmConfig.DeletionProtection != nil {
err = d.Set(
mkProtection,
@ -4721,8 +4715,7 @@ func vmReadPrimitiveValues(
currentTabletDevice := d.Get(mkTabletDevice).(bool)
//nolint:gosimple
if len(clone) == 0 || currentTabletDevice != dvTabletDevice {
if len(clone) == 0 || !currentTabletDevice {
if vmConfig.TabletDeviceEnabled != nil {
err = d.Set(
mkTabletDevice,
@ -4738,8 +4731,7 @@ func vmReadPrimitiveValues(
currentTemplate := d.Get(mkTemplate).(bool)
//nolint:gosimple
if len(clone) == 0 || currentTemplate != dvTemplate {
if len(clone) == 0 || currentTemplate {
if vmConfig.Template != nil {
err = d.Set(mkTemplate, bool(*vmConfig.Template))
} else {