mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 02:31: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:
parent
2ae77257d3
commit
1eee8cdbd0
4
.github/workflows/golangci-lint.yml
vendored
4
.github/workflows/golangci-lint.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Lint code
|
- name: Lint code
|
||||||
if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}}
|
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:
|
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
|
args: -v --timeout=10m
|
||||||
|
153
.golangci.yml
153
.golangci.yml
@ -1,88 +1,97 @@
|
|||||||
issues:
|
version: "2"
|
||||||
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:
|
linters:
|
||||||
- cyclop
|
default: all
|
||||||
- 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/*
|
|
||||||
linters:
|
|
||||||
enable-all: true
|
|
||||||
disable:
|
disable:
|
||||||
# deprecated
|
- canonicalheader
|
||||||
- gocyclo
|
|
||||||
- rowserrcheck
|
|
||||||
- tenv
|
|
||||||
- wastedassign
|
|
||||||
# require massive refactoring
|
|
||||||
- cyclop
|
- cyclop
|
||||||
|
- depguard
|
||||||
|
- err113
|
||||||
|
- exhaustruct
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- funlen
|
- funlen
|
||||||
- gocognit
|
- gocognit
|
||||||
# others
|
- gocyclo
|
||||||
- canonicalheader
|
|
||||||
- depguard
|
|
||||||
- exhaustruct
|
|
||||||
- gci
|
|
||||||
- err113
|
|
||||||
- ireturn
|
- ireturn
|
||||||
- maintidx
|
- maintidx
|
||||||
- mnd
|
- mnd
|
||||||
- nestif
|
- nestif
|
||||||
- nlreturn
|
- nlreturn
|
||||||
- perfsprint
|
- perfsprint
|
||||||
|
- rowserrcheck
|
||||||
- tagliatelle
|
- tagliatelle
|
||||||
- testpackage
|
- testpackage
|
||||||
- tparallel
|
- tparallel
|
||||||
- varnamelen
|
- 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$
|
||||||
|
1
.vscode/settings.example.json
vendored
1
.vscode/settings.example.json
vendored
@ -33,7 +33,6 @@
|
|||||||
"FSTRIM",
|
"FSTRIM",
|
||||||
"fwprovider",
|
"fwprovider",
|
||||||
"gocritic",
|
"gocritic",
|
||||||
"gosimple",
|
|
||||||
"hookscript",
|
"hookscript",
|
||||||
"hostnodes",
|
"hostnodes",
|
||||||
"hostpci",
|
"hostpci",
|
||||||
|
6
Makefile
6
Makefile
@ -3,7 +3,7 @@ TARGETS=darwin linux windows
|
|||||||
TERRAFORM_PLUGIN_EXTENSION=
|
TERRAFORM_PLUGIN_EXTENSION=
|
||||||
VERSION=0.73.2# x-release-please-version
|
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,
|
# check if opentofu is installed and use it if it is,
|
||||||
# otherwise use terraform
|
# otherwise use terraform
|
||||||
@ -111,8 +111,8 @@ testacc:
|
|||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
# NOTE: This target runs only locally, not in CI. See .github/workflows/golangci-lint.yml for CI linting.
|
# 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 run --fix
|
@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
|
.PHONY: release-build
|
||||||
release-build:
|
release-build:
|
||||||
|
@ -1395,8 +1395,7 @@ func containerCreateClone(ctx context.Context, d *schema.ResourceData, m interfa
|
|||||||
|
|
||||||
template := types.CustomBool(d.Get(mkTemplate).(bool))
|
template := types.CustomBool(d.Get(mkTemplate).(bool))
|
||||||
|
|
||||||
//nolint:gosimple
|
if template {
|
||||||
if template != dvTemplate {
|
|
||||||
updateBody.Template = &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))
|
mountPointArray := make(containers.CustomMountPointArray, 0, len(mountPoint))
|
||||||
|
|
||||||
// because of default bool values:
|
// because of default bool values:
|
||||||
//nolint:gosimple
|
|
||||||
for _, mp := range mountPoint {
|
for _, mp := range mountPoint {
|
||||||
mountPointMap := mp.(map[string]interface{})
|
mountPointMap := mp.(map[string]interface{})
|
||||||
mountPointObject := containers.CustomMountPoint{}
|
mountPointObject := containers.CustomMountPoint{}
|
||||||
@ -1622,11 +1621,11 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
volume := mountPointMap[mkMountPointVolume].(string)
|
volume := mountPointMap[mkMountPointVolume].(string)
|
||||||
|
|
||||||
// we have to set only the values that are different from the provider's defaults,
|
// we have to set only the values that are different from the provider's defaults,
|
||||||
if acl != dvMountPointACL {
|
if acl {
|
||||||
mountPointObject.ACL = &acl
|
mountPointObject.ACL = &acl
|
||||||
}
|
}
|
||||||
|
|
||||||
if backup != dvMountPointBackup {
|
if backup {
|
||||||
mountPointObject.Backup = &backup
|
mountPointObject.Backup = &backup
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1634,19 +1633,19 @@ func containerCreateCustom(ctx context.Context, d *schema.ResourceData, m interf
|
|||||||
mountPointObject.MountPoint = path
|
mountPointObject.MountPoint = path
|
||||||
}
|
}
|
||||||
|
|
||||||
if quota != dvMountPointQuota {
|
if quota {
|
||||||
mountPointObject.Quota = "a
|
mountPointObject.Quota = "a
|
||||||
}
|
}
|
||||||
|
|
||||||
if readOnly != dvMountPointReadOnly {
|
if readOnly {
|
||||||
mountPointObject.ReadOnly = &readOnly
|
mountPointObject.ReadOnly = &readOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
if replicate != dvMountPointReplicate {
|
if !replicate {
|
||||||
mountPointObject.Replicate = &replicate
|
mountPointObject.Replicate = &replicate
|
||||||
}
|
}
|
||||||
|
|
||||||
if shared != dvMountPointShared {
|
if shared {
|
||||||
mountPointObject.Shared = &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))
|
currentProtection := types.CustomBool(d.Get(mkProtection).(bool))
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || currentProtection {
|
||||||
if len(clone) == 0 || currentProtection != dvProtection {
|
|
||||||
if containerConfig.Protection != nil {
|
if containerConfig.Protection != nil {
|
||||||
e = d.Set(
|
e = d.Set(
|
||||||
mkProtection,
|
mkProtection,
|
||||||
@ -2782,8 +2780,7 @@ func containerRead(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
|
|
||||||
currentTemplate := d.Get(mkTemplate).(bool)
|
currentTemplate := d.Get(mkTemplate).(bool)
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || currentTemplate {
|
||||||
if len(clone) == 0 || currentTemplate != dvTemplate {
|
|
||||||
if containerConfig.Template != nil {
|
if containerConfig.Template != nil {
|
||||||
e = d.Set(
|
e = d.Set(
|
||||||
mkTemplate,
|
mkTemplate,
|
||||||
|
@ -1923,8 +1923,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
|
|
||||||
var del []string
|
var del []string
|
||||||
|
|
||||||
//nolint:gosimple
|
if !acpi {
|
||||||
if acpi != dvACPI {
|
|
||||||
updateBody.ACPI = &acpi
|
updateBody.ACPI = &acpi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2144,13 +2143,11 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
|
|
||||||
updateBody.StartupOrder = vmGetStartupOrder(d)
|
updateBody.StartupOrder = vmGetStartupOrder(d)
|
||||||
|
|
||||||
//nolint:gosimple
|
if !tabletDevice {
|
||||||
if tabletDevice != dvTabletDevice {
|
|
||||||
updateBody.TabletDeviceEnabled = &tabletDevice
|
updateBody.TabletDeviceEnabled = &tabletDevice
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gosimple
|
if protection {
|
||||||
if protection != dvProtection {
|
|
||||||
updateBody.DeletionProtection = &protection
|
updateBody.DeletionProtection = &protection
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2159,8 +2156,7 @@ func vmCreateClone(ctx context.Context, d *schema.ResourceData, m interface{}) d
|
|||||||
updateBody.Tags = &tagString
|
updateBody.Tags = &tagString
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gosimple
|
if template {
|
||||||
if template != dvTemplate {
|
|
||||||
updateBody.Template = &template
|
updateBody.Template = &template
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4587,8 +4583,7 @@ func vmReadPrimitiveValues(
|
|||||||
clone := d.Get(mkClone).([]interface{})
|
clone := d.Get(mkClone).([]interface{})
|
||||||
currentACPI := d.Get(mkACPI).(bool)
|
currentACPI := d.Get(mkACPI).(bool)
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || !currentACPI {
|
||||||
if len(clone) == 0 || currentACPI != dvACPI {
|
|
||||||
if vmConfig.ACPI != nil {
|
if vmConfig.ACPI != nil {
|
||||||
err = d.Set(mkACPI, bool(*vmConfig.ACPI))
|
err = d.Set(mkACPI, bool(*vmConfig.ACPI))
|
||||||
} else {
|
} else {
|
||||||
@ -4699,8 +4694,7 @@ func vmReadPrimitiveValues(
|
|||||||
|
|
||||||
currentProtection := d.Get(mkProtection).(bool)
|
currentProtection := d.Get(mkProtection).(bool)
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || currentProtection {
|
||||||
if len(clone) == 0 || currentProtection != dvProtection {
|
|
||||||
if vmConfig.DeletionProtection != nil {
|
if vmConfig.DeletionProtection != nil {
|
||||||
err = d.Set(
|
err = d.Set(
|
||||||
mkProtection,
|
mkProtection,
|
||||||
@ -4721,8 +4715,7 @@ func vmReadPrimitiveValues(
|
|||||||
|
|
||||||
currentTabletDevice := d.Get(mkTabletDevice).(bool)
|
currentTabletDevice := d.Get(mkTabletDevice).(bool)
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || !currentTabletDevice {
|
||||||
if len(clone) == 0 || currentTabletDevice != dvTabletDevice {
|
|
||||||
if vmConfig.TabletDeviceEnabled != nil {
|
if vmConfig.TabletDeviceEnabled != nil {
|
||||||
err = d.Set(
|
err = d.Set(
|
||||||
mkTabletDevice,
|
mkTabletDevice,
|
||||||
@ -4738,8 +4731,7 @@ func vmReadPrimitiveValues(
|
|||||||
|
|
||||||
currentTemplate := d.Get(mkTemplate).(bool)
|
currentTemplate := d.Get(mkTemplate).(bool)
|
||||||
|
|
||||||
//nolint:gosimple
|
if len(clone) == 0 || currentTemplate {
|
||||||
if len(clone) == 0 || currentTemplate != dvTemplate {
|
|
||||||
if vmConfig.Template != nil {
|
if vmConfig.Template != nil {
|
||||||
err = d.Set(mkTemplate, bool(*vmConfig.Template))
|
err = d.Set(mkTemplate, bool(*vmConfig.Template))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user