From 7065c4200d2a16f26e47ac84caa657a54d2df356 Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Thu, 24 Oct 2024 13:38:36 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/) From 4429e3a00ada33a579ac1344cb06e721eb3e5a12 Mon Sep 17 00:00:00 2001 From: Richard87 Date: Thu, 24 Oct 2024 13:42:31 +0200 Subject: [PATCH 2/3] fix: linting bugs --- Makefile | 35 +++++++++++++++++++++++++++++++++++ main_test.go | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ade5904 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +ENVIRONMENT ?= dev + +CONTAINER_REPO ?= radix$(ENVIRONMENT) +DOCKER_REGISTRY ?= $(CONTAINER_REPO).azurecr.io + +BINS = radix-api +IMAGES = radix-api + +GIT_TAG = $(shell git describe --tags --always 2>/dev/null) +CURRENT_FOLDER = $(shell pwd) +VERSION ?= ${GIT_TAG} +IMAGE_TAG ?= ${VERSION} +LDFLAGS += -s -w + +CX_OSES = linux windows +CX_ARCHS = amd64 + +.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/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) From 58953a390e382fca0fe06ebe3cbfdc360c389b9f Mon Sep 17 00:00:00 2001 From: Richard87 Date: Thu, 24 Oct 2024 13:43:04 +0200 Subject: [PATCH 3/3] fix: cleanup makefile --- Makefile | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Makefile b/Makefile index ade5904..1d6f238 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,3 @@ -ENVIRONMENT ?= dev - -CONTAINER_REPO ?= radix$(ENVIRONMENT) -DOCKER_REGISTRY ?= $(CONTAINER_REPO).azurecr.io - -BINS = radix-api -IMAGES = radix-api - -GIT_TAG = $(shell git describe --tags --always 2>/dev/null) -CURRENT_FOLDER = $(shell pwd) -VERSION ?= ${GIT_TAG} -IMAGE_TAG ?= ${VERSION} -LDFLAGS += -s -w - -CX_OSES = linux windows -CX_ARCHS = amd64 .PHONY: build build: $(BINS)