From 8f7966cab305d4c1169e56df6f75d0fd89f58aac Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 22 Jun 2023 19:15:02 +0100 Subject: [PATCH 1/3] add vet command and step to pipeline --- .gitlab-ci.yml | 6 ++++++ Makefile | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 668d3fb..c514e4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,6 +19,12 @@ format: script: - make check/fmt +vet: + extends: .go_template + stage: test + script: + - make vet + test: extends: .go_template stage: test diff --git a/Makefile b/Makefile index e1854b8..4421341 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ update: test: download go test ./... -v -race +# Look for "suspicious constructs" in source code +.PHONY: vet +vet: download + go vet ./... + # Format code .PHONY: fmt fmt: download From f39b34745ac9a38ddd554a16acb705ed380125bc Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 22 Jun 2023 19:17:03 +0100 Subject: [PATCH 2/3] allow failure of vet step --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c514e4e..a7e3c55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,7 @@ format: vet: extends: .go_template stage: test + allow_failure: true script: - make vet From a5d2c98517ab7c3c0a2847d078df395d0dfadbd8 Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 22 Jun 2023 19:20:46 +0100 Subject: [PATCH 3/3] fix issue raised by go vet --- exporter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter.go b/exporter.go index 6e7ae25..5dc6e0d 100644 --- a/exporter.go +++ b/exporter.go @@ -53,7 +53,7 @@ func main() { } func handleGracefulShutdown() { - var signals = make(chan os.Signal) + var signals = make(chan os.Signal, 1) signal.Notify(signals, syscall.SIGTERM) signal.Notify(signals, syscall.SIGINT)