diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1d6f238 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ + +.PHONY: build +build: $(BINS) + +.PHONY: test +test: + go test -cover `go list ./...` + +.PHONY: lint +lint: bootstrap + golangci-lint run --max-same-issues 0 --timeout 10m + + +HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;) + +bootstrap: +ifndef HAS_GOLANGCI_LINT + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 +endif diff --git a/README.md b/README.md index 9c9551d..06ec113 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org) [![Release](https://github.com/equinor/radix-ingress-default-backend/actions/workflows/release-please.yaml/badge.svg?branch=main&event=push)](https://github.com/equinor/radix-ingress-default-backend/actions/workflows/release-please.yaml) [![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/radix-ingress-default-backend/badge)](https://developer.equinor.com/governance/scm-policy/) diff --git a/main_test.go b/main_test.go index 505b0b4..83c93dd 100644 --- a/main_test.go +++ b/main_test.go @@ -17,6 +17,7 @@ func TestRun(t *testing.T) { defer server.Close() req, err := http.NewRequest(http.MethodGet, server.URL, nil) + require.NoError(t, err) req.Header.Add("X-Namespace", "hello-world-dev") req.Header.Add("X-Code", "503") regularRequest, err := http.DefaultClient.Do(req) @@ -28,6 +29,7 @@ func TestRun(t *testing.T) { assert.Contains(t, string(bytes), "Server error - Radix") req, err = http.NewRequest(http.MethodGet, server.URL, nil) + require.NoError(t, err) req.Header.Add("X-Namespace", "equinor-web-sites-dev") req.Header.Add("X-Code", "503") equinorRequst, err := http.DefaultClient.Do(req)