Skip to content

Commit

Permalink
Merge branch 'master' into fix-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
fahlmant authored Feb 13, 2025
2 parents a5cca85 + 73579fb commit 1a9a9ee
Show file tree
Hide file tree
Showing 98 changed files with 1,275 additions and 840 deletions.
6 changes: 3 additions & 3 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ $(GOJQ): $(BINGO_DIR)/gojq.mod
@echo "(re)installing $(GOBIN)/gojq-v0.12.16"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=gojq.mod -o=$(GOBIN)/gojq-v0.12.16 "github.com/itchyny/gojq/cmd/gojq"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.1
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.63.4
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.1 "github.com/golangci/golangci-lint/cmd/golangci-lint"
@echo "(re)installing $(GOBIN)/golangci-lint-v1.63.4"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.63.4 "github.com/golangci/golangci-lint/cmd/golangci-lint"

GOTESTSUM := $(GOBIN)/gotestsum-v1.11.0
$(GOTESTSUM): $(BINGO_DIR)/gotestsum.mod
Expand Down
2 changes: 1 addition & 1 deletion .bingo/golangci-lint.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.22.9

require github.com/golangci/golangci-lint v1.59.1 // cmd/golangci-lint
require github.com/golangci/golangci-lint v1.63.4 // cmd/golangci-lint
194 changes: 194 additions & 0 deletions .bingo/golangci-lint.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GOCOV="${GOBIN}/gocov-v1.1.0"

GOJQ="${GOBIN}/gojq-v0.12.16"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.1"
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.63.4"

GOTESTSUM="${GOBIN}/gotestsum-v1.11.0"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
version: v1.63.4
args: -v --timeout 15m

validate-go:
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run:
- "containers_image_openpgp"
- "exclude_graphdriver_devicemapper"
- "exclude_graphdriver_btrfs"
go: "1.21"
go: "1.22"

output:
format: github-actions
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Azure/go-autorest/autorest/validation v0.3.1
github.com/Azure/go-autorest/tracing v0.6.0
github.com/Azure/msi-dataplane v0.3.0
github.com/Azure/msi-dataplane v0.4.0
github.com/apparentlymart/go-cidr v1.1.0
github.com/codahale/etm v0.0.0-20141003032925-c00c9e6fb4c9
github.com/containers/image/v5 v5.31.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/Azure/msi-dataplane v0.3.0 h1:ng54QWSDGct4crZJ0Ea7Zt/ZbaQLO2s7yXicWRPyLP4=
github.com/Azure/msi-dataplane v0.3.0/go.mod h1:y+euhWbc8/wgVM1hyJLQf4DnByegnwxAcDV0OKNM9+k=
github.com/Azure/msi-dataplane v0.4.0 h1:lofdhX74IgMEvIe6cw8tdwr3zfZkdk77TXetFv0/By8=
github.com/Azure/msi-dataplane v0.4.0/go.mod h1:y+euhWbc8/wgVM1hyJLQf4DnByegnwxAcDV0OKNM9+k=
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
Expand Down
5 changes: 3 additions & 2 deletions pkg/api/admin/operatorflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package admin

import (
"encoding/json"
"fmt"
"net/http"

"github.com/Azure/ARO-RP/pkg/api"
Expand All @@ -28,7 +29,7 @@ func OperatorFlagsMergeStrategy(oc *api.OpenShiftCluster, body []byte) error {

err := json.Unmarshal(body, &payload)
if err != nil {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidRequestContent, "", "The request content was invalid and could not be deserialized: %q.", err)
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidRequestContent, "", fmt.Sprintf("The request content was invalid and could not be deserialized: %q.", err))
}

// if it's empty, use the default of merge, which is performed by
Expand All @@ -40,7 +41,7 @@ func OperatorFlagsMergeStrategy(oc *api.OpenShiftCluster, body []byte) error {
// return error if OperatorFlagsMergeStrategy is not merge or reset, default is merge
if payload.OperatorFlagsMergeStrategy != OperatorFlagsMergeStrategyMerge &&
payload.OperatorFlagsMergeStrategy != OperatorFlagsMergeStrategyReset {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "", "invalid operatorFlagsMergeStrategy '%s', can only be 'merge' or 'reset'", payload.OperatorFlagsMergeStrategy)
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "", fmt.Sprintf("invalid operatorFlagsMergeStrategy '%s', can only be 'merge' or 'reset'", payload.OperatorFlagsMergeStrategy))
}

// return nil, if OperatorFlagsMergeStrategy is merge and payload has not operatorFlags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (sv platformWorkloadIdentityRoleSetStaticValidator) validate(new *PlatformW
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.openShiftVersion", "Must be provided")
}

if new.Properties.PlatformWorkloadIdentityRoles == nil || len(new.Properties.PlatformWorkloadIdentityRoles) == 0 {
if len(new.Properties.PlatformWorkloadIdentityRoles) == 0 {
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.platformWorkloadIdentityRoles", "Must be provided and must be non-empty")
}

Expand All @@ -58,7 +58,7 @@ func (sv platformWorkloadIdentityRoleSetStaticValidator) validate(new *PlatformW
missingProperties = append(missingProperties, fmt.Sprintf("properties.platformWorkloadIdentityRoles[%d].roleDefinitionId", i))
}

if r.ServiceAccounts == nil || len(r.ServiceAccounts) == 0 {
if len(r.ServiceAccounts) == 0 {
missingProperties = append(missingProperties, fmt.Sprintf("properties.platformWorkloadIdentityRoles[%d].serviceAccounts", i))
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@ const (
)

// NewCloudError returns a new CloudError
func NewCloudError(statusCode int, code, target, message string, a ...interface{}) *CloudError {
func NewCloudError(statusCode int, code, target, message string) *CloudError {
return &CloudError{
StatusCode: statusCode,
CloudErrorBody: &CloudErrorBody{
Code: code,
Message: fmt.Sprintf(message, a...),
Message: message,
Target: target,
},
}
}

// WriteError constructs and writes a CloudError to the given ResponseWriter
func WriteError(w http.ResponseWriter, statusCode int, code, target, message string, a ...interface{}) {
WriteCloudError(w, NewCloudError(statusCode, code, target, message, a...))
func WriteError(w http.ResponseWriter, statusCode int, code, target, message string) {
WriteCloudError(w, NewCloudError(statusCode, code, target, message))
}

// WriteCloudError writes a CloudError to the given ResponseWriter
Expand Down
Loading

0 comments on commit 1a9a9ee

Please sign in to comment.