feat: Update golangci-lint version to 1.62.0 and go version to 1.23
Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
This commit is contained in:
parent
1051995ad6
commit
3a378c7b38
9 changed files with 22 additions and 27 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -3,7 +3,7 @@ name: CI Workflow
|
||||||
on: [pull_request, workflow_dispatch]
|
on: [pull_request, workflow_dispatch]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GO_VERSION: "1.22"
|
GO_VERSION: "1.23"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -1,6 +1,6 @@
|
||||||
module github.com/stackitcloud/terraform-provider-stackit
|
module github.com/stackitcloud/terraform-provider-stackit
|
||||||
|
|
||||||
go 1.22
|
go 1.23
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/go-cmp v0.6.0
|
github.com/google/go-cmp v0.6.0
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,12 @@ linters-settings:
|
||||||
# it's a comma-separated list of prefixes
|
# it's a comma-separated list of prefixes
|
||||||
local-prefixes: github.com/freiheit-com/nmww
|
local-prefixes: github.com/freiheit-com/nmww
|
||||||
depguard:
|
depguard:
|
||||||
list-type: blacklist
|
rules:
|
||||||
include-go-root: false
|
main:
|
||||||
packages:
|
list-mode: lax # Everything is allowed unless it is denied
|
||||||
- github.com/stretchr/testify
|
deny:
|
||||||
packages-with-error-message:
|
- pkg: "github.com/stretchr/testify"
|
||||||
# specify an error message to output when a blacklisted package is used
|
desc: Do not use a testing framework
|
||||||
- github.com/stretchr/testify: "do not use a testing framework"
|
|
||||||
misspell:
|
misspell:
|
||||||
# Correct spellings using locale preferences for US or UK.
|
# Correct spellings using locale preferences for US or UK.
|
||||||
# Default is to use a neutral variety of English.
|
# Default is to use a neutral variety of English.
|
||||||
|
|
@ -75,7 +74,6 @@ linters:
|
||||||
- unused
|
- unused
|
||||||
# additional linters
|
# additional linters
|
||||||
- errorlint
|
- errorlint
|
||||||
- exportloopref
|
|
||||||
- gochecknoinits
|
- gochecknoinits
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofmt
|
- gofmt
|
||||||
|
|
@ -91,9 +89,6 @@ linters:
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- errcheck
|
- errcheck
|
||||||
disable:
|
disable:
|
||||||
- structcheck # deprecated
|
|
||||||
- deadcode # deprecated
|
|
||||||
- varcheck # deprecated
|
|
||||||
- noctx # false positive: finds errors with http.NewRequest that dont make sense
|
- noctx # false positive: finds errors with http.NewRequest that dont make sense
|
||||||
- unparam # false positives
|
- unparam # false positives
|
||||||
issues:
|
issues:
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ elif [ "$action" = "tools" ]; then
|
||||||
|
|
||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
|
||||||
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.16.0
|
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.16.0
|
||||||
else
|
else
|
||||||
echo "Invalid action: '$action', please use $0 help for help"
|
echo "Invalid action: '$action', please use $0 help for help"
|
||||||
|
|
|
||||||
|
|
@ -854,7 +854,7 @@ func TestUpdateNetworkRanges(t *testing.T) {
|
||||||
networkRangesStates["pr-3"] = true
|
networkRangesStates["pr-3"] = true
|
||||||
|
|
||||||
// Handler for getting all network ranges
|
// Handler for getting all network ranges
|
||||||
getAllNetworkRangesHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
getAllNetworkRangesHandler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
if tt.getAllNetworkRangesFails {
|
if tt.getAllNetworkRangesFails {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,7 @@ func TestReadCredentials(t *testing.T) {
|
||||||
t.Fatalf("Failed to marshal mocked response: %v", err)
|
t.Fatalf("Failed to marshal mocked response: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
if tt.getCredentialsFails {
|
if tt.getCredentialsFails {
|
||||||
w.WriteHeader(http.StatusBadGateway)
|
w.WriteHeader(http.StatusBadGateway)
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,7 @@ func TestUpdateACLs(t *testing.T) {
|
||||||
aclsStates["acl-3"] = true
|
aclsStates["acl-3"] = true
|
||||||
|
|
||||||
// Handler for getting all ACLs
|
// Handler for getting all ACLs
|
||||||
getAllACLsHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
getAllACLsHandler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
if tt.getAllACLsFails {
|
if tt.getAllACLsFails {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
|
||||||
Optional: true,
|
Optional: true,
|
||||||
DeprecationMessage: "Use `kubernetes_version_min instead`. Setting a specific kubernetes version would cause errors during minor version upgrades due to forced updates. In those cases, this field might not represent the actual kubernetes version used in the cluster.",
|
DeprecationMessage: "Use `kubernetes_version_min instead`. Setting a specific kubernetes version would cause errors during minor version upgrades due to forced updates. In those cases, this field might not represent the actual kubernetes version used in the cluster.",
|
||||||
PlanModifiers: []planmodifier.String{
|
PlanModifiers: []planmodifier.String{
|
||||||
stringplanmodifier.RequiresReplaceIf(stringplanmodifier.RequiresReplaceIfFunc(func(ctx context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
|
stringplanmodifier.RequiresReplaceIf(stringplanmodifier.RequiresReplaceIfFunc(func(_ context.Context, sr planmodifier.StringRequest, rrifr *stringplanmodifier.RequiresReplaceIfFuncResponse) {
|
||||||
if sr.StateValue.IsNull() || sr.PlanValue.IsNull() {
|
if sr.StateValue.IsNull() || sr.PlanValue.IsNull() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ func UUID() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
if _, err := uuid.Parse(req.ConfigValue.ValueString()); err != nil {
|
if _, err := uuid.Parse(req.ConfigValue.ValueString()); err != nil {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
req.Path,
|
req.Path,
|
||||||
|
|
@ -71,7 +71,7 @@ func IP() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
if net.ParseIP(req.ConfigValue.ValueString()) == nil {
|
if net.ParseIP(req.ConfigValue.ValueString()) == nil {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
req.Path,
|
req.Path,
|
||||||
|
|
@ -127,7 +127,7 @@ func NoSeparator() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
if strings.Contains(req.ConfigValue.ValueString(), core.Separator) {
|
if strings.Contains(req.ConfigValue.ValueString(), core.Separator) {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
req.Path,
|
req.Path,
|
||||||
|
|
@ -144,7 +144,7 @@ func NonLegacyProjectRole() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
if utils.IsLegacyProjectRole(req.ConfigValue.ValueString()) {
|
if utils.IsLegacyProjectRole(req.ConfigValue.ValueString()) {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
req.Path,
|
req.Path,
|
||||||
|
|
@ -161,7 +161,7 @@ func MinorVersionNumber() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
exp := MajorMinorVersionRegex
|
exp := MajorMinorVersionRegex
|
||||||
r := regexp.MustCompile(exp)
|
r := regexp.MustCompile(exp)
|
||||||
version := req.ConfigValue.ValueString()
|
version := req.ConfigValue.ValueString()
|
||||||
|
|
@ -181,7 +181,7 @@ func VersionNumber() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
minorVersionExp := MajorMinorVersionRegex
|
minorVersionExp := MajorMinorVersionRegex
|
||||||
minorVersionRegex := regexp.MustCompile(minorVersionExp)
|
minorVersionRegex := regexp.MustCompile(minorVersionExp)
|
||||||
|
|
||||||
|
|
@ -205,7 +205,7 @@ func RFC3339SecondsOnly() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
t, err := time.Parse(time.RFC3339, req.ConfigValue.ValueString())
|
t, err := time.Parse(time.RFC3339, req.ConfigValue.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
|
|
@ -233,7 +233,7 @@ func CIDR() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
_, _, err := net.ParseCIDR(req.ConfigValue.ValueString())
|
_, _, err := net.ParseCIDR(req.ConfigValue.ValueString())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
|
||||||
|
|
@ -251,7 +251,7 @@ func Rrule() *Validator {
|
||||||
|
|
||||||
return &Validator{
|
return &Validator{
|
||||||
description: description,
|
description: description,
|
||||||
validate: func(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
validate: func(_ context.Context, req validator.StringRequest, resp *validator.StringResponse) {
|
||||||
// The go library rrule-go expects \n before RRULE (to be a newline and not a space)
|
// The go library rrule-go expects \n before RRULE (to be a newline and not a space)
|
||||||
// for example: "DTSTART;TZID=America/New_York:19970902T090000\nRRULE:FREQ=DAILY;COUNT=10"
|
// for example: "DTSTART;TZID=America/New_York:19970902T090000\nRRULE:FREQ=DAILY;COUNT=10"
|
||||||
// whereas a valid rrule according to the API docs is:
|
// whereas a valid rrule according to the API docs is:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue