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:
Alexander Dahmen 2024-11-26 14:54:44 +01:00 committed by Alexander Dahmen
parent 1051995ad6
commit 3a378c7b38
9 changed files with 22 additions and 27 deletions

View file

@ -3,7 +3,7 @@ name: CI Workflow
on: [pull_request, workflow_dispatch]
env:
GO_VERSION: "1.22"
GO_VERSION: "1.23"
jobs:
main:

2
go.mod
View file

@ -1,6 +1,6 @@
module github.com/stackitcloud/terraform-provider-stackit
go 1.22
go 1.23
require (
github.com/google/go-cmp v0.6.0

View file

@ -14,13 +14,12 @@ linters-settings:
# it's a comma-separated list of prefixes
local-prefixes: github.com/freiheit-com/nmww
depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/stretchr/testify
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- github.com/stretchr/testify: "do not use a testing framework"
rules:
main:
list-mode: lax # Everything is allowed unless it is denied
deny:
- pkg: "github.com/stretchr/testify"
desc: Do not use a testing framework
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
@ -75,7 +74,6 @@ linters:
- unused
# additional linters
- errorlint
- exportloopref
- gochecknoinits
- gocritic
- gofmt
@ -91,9 +89,6 @@ linters:
- forcetypeassert
- errcheck
disable:
- structcheck # deprecated
- deadcode # deprecated
- varcheck # deprecated
- noctx # false positive: finds errors with http.NewRequest that dont make sense
- unparam # false positives
issues:

View file

@ -16,7 +16,7 @@ elif [ "$action" = "tools" ]; then
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
else
echo "Invalid action: '$action', please use $0 help for help"

View file

@ -854,7 +854,7 @@ func TestUpdateNetworkRanges(t *testing.T) {
networkRangesStates["pr-3"] = true
// 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")
if tt.getAllNetworkRangesFails {
w.WriteHeader(http.StatusInternalServerError)

View file

@ -381,7 +381,7 @@ func TestReadCredentials(t *testing.T) {
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")
if tt.getCredentialsFails {
w.WriteHeader(http.StatusBadGateway)

View file

@ -345,7 +345,7 @@ func TestUpdateACLs(t *testing.T) {
aclsStates["acl-3"] = true
// 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")
if tt.getAllACLsFails {
w.WriteHeader(http.StatusInternalServerError)

View file

@ -353,7 +353,7 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
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.",
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() {
return
}

View file

@ -54,7 +54,7 @@ func UUID() *Validator {
return &Validator{
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 {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
@ -71,7 +71,7 @@ func IP() *Validator {
return &Validator{
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 {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
@ -127,7 +127,7 @@ func NoSeparator() *Validator {
return &Validator{
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) {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
@ -144,7 +144,7 @@ func NonLegacyProjectRole() *Validator {
return &Validator{
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()) {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
@ -161,7 +161,7 @@ func MinorVersionNumber() *Validator {
return &Validator{
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
r := regexp.MustCompile(exp)
version := req.ConfigValue.ValueString()
@ -181,7 +181,7 @@ func VersionNumber() *Validator {
return &Validator{
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
minorVersionRegex := regexp.MustCompile(minorVersionExp)
@ -205,7 +205,7 @@ func RFC3339SecondsOnly() *Validator {
return &Validator{
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())
if err != nil {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
@ -233,7 +233,7 @@ func CIDR() *Validator {
return &Validator{
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())
if err != nil {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
@ -251,7 +251,7 @@ func Rrule() *Validator {
return &Validator{
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)
// for example: "DTSTART;TZID=America/New_York:19970902T090000\nRRULE:FREQ=DAILY;COUNT=10"
// whereas a valid rrule according to the API docs is: