Skip to content

Commit e2ea531

Browse files
authored
Merge pull request #524 from mbaldessari/newgolang-ci-2.11.3
Update golangci-lint to 2.11.3
2 parents f95aed4 + e88c469 commit e2ea531

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Run golangci-lint
3030
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3131
with:
32-
version: v2.10.1
32+
version: v2.11.3
3333
args: --timeout 5m -v
3434

3535
#--exclude SA5011

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GOFLAGS=-mod=vendor
99
REGISTRY ?= localhost
1010
UPLOADREGISTRY ?= quay.io/validatedpatterns
1111
GOLANGCI_IMG ?= docker.io/golangci/golangci-lint
12-
GOLANGCI_VERSION ?= 2.10.1
12+
GOLANGCI_VERSION ?= 2.11.3
1313

1414
# CI uses a non-writable home dir, make sure .cache is writable
1515
ifeq ("${HOME}", "/")

internal/controller/pattern_controller.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"io"
2626
"log"
2727
"net/http"
28+
"net/url"
2829
"os"
2930
"path/filepath"
3031
"strings"
@@ -964,6 +965,16 @@ func (r *PatternReconciler) checkSpokeApplicationsGone(appOfApps bool) (bool, er
964965
searchURL = fmt.Sprintf("https://search-search-api.%s.svc.cluster.local:4010/searchapi/graphql", searchNamespace)
965966
}
966967

968+
parsedURL, err := url.Parse(searchURL)
969+
if err != nil || (parsedURL.Scheme != "https" && parsedURL.Scheme != "http") {
970+
return false, fmt.Errorf("invalid search API URL: %s", searchURL)
971+
}
972+
cleanURL := url.URL{
973+
Scheme: parsedURL.Scheme,
974+
Host: parsedURL.Host,
975+
Path: parsedURL.Path,
976+
}
977+
967978
token := os.Getenv("ACM_SEARCH_API_TOKEN")
968979
if token == "" {
969980
var tokenBytes []byte
@@ -1021,7 +1032,7 @@ func (r *PatternReconciler) checkSpokeApplicationsGone(appOfApps bool) (bool, er
10211032
}
10221033

10231034
// Create HTTP request
1024-
req, err := http.NewRequestWithContext(context.Background(), "POST", searchURL, bytes.NewBuffer(queryJSON))
1035+
req, err := http.NewRequestWithContext(context.Background(), "POST", cleanURL.String(), bytes.NewBuffer(queryJSON))
10251036
if err != nil {
10261037
return false, fmt.Errorf("failed to create HTTP request: %w", err)
10271038
}

0 commit comments

Comments
 (0)