From 9fa5d5263e324e3729b5a39e523870f563e09cf0 Mon Sep 17 00:00:00 2001 From: Abhishek Rai Date: Mon, 4 Nov 2024 08:24:03 -0800 Subject: [PATCH 1/2] chore: Upgrade go version to 1.23.2 Signed-off-by: Abhishek Rai --- .golangci.yaml | 7 ++++++- Dockerfile | 7 ++++--- Makefile | 9 +++++---- go.mod | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 1ea5cd5..c7a43f5 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,6 +9,11 @@ linters-settings: linters: enable: - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - unused run: timeout: 5m @@ -17,4 +22,4 @@ issues: skip-dirs: - vendor skip-files: - - generated.go \ No newline at end of file + - generated.go diff --git a/Dockerfile b/Dockerfile index 801ecd0..46f5bee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.5 AS builder +FROM golang:1.23.2 AS builder ENV GOOS=linux @@ -8,6 +8,8 @@ COPY . . RUN make mod +RUN make test + RUN make build FROM ubuntu:24.04 @@ -17,8 +19,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN groupadd -r promgithub &&\ useradd -md /bin/bash --no-log-init -r -g promgithub promgithub -RUN apt-get update && apt-get install -y \ - ca-certificates \ +RUN apt-get update && apt-get install -y ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app diff --git a/Makefile b/Makefile index a76a104..4c5fa41 100644 --- a/Makefile +++ b/Makefile @@ -17,13 +17,13 @@ help: mkdir: @mkdir -p $(BUILDDIR) -go-version: ## Get the Go version from go.mod - @grep '^go ' go.mod | awk '{print $$2}' - mod: ## Update go modules @go mod tidy @go mod verify +go-version: ## Get the Go version from go.mod + @grep '^go ' go.mod | awk '{print $$2}' + build: ## Build promgithub service binary build: CGO_ENABLED := 0 build: mkdir @@ -40,8 +40,9 @@ cross-platform: mkdir GOOS=linux GOARCH=$$GOARCH $(MAKE) TARGET=$(TARGET)-linux-$$GOARCH-$(VERSION) build; \ done -test: GITHUB_WEBHOOK_SECRET := test-secret test: ## Run unit tests +test: PROMGITHUB_WEBHOOK_SECRET := test-secret +test: @go test -v $(SRC) lint: ## Run linter diff --git a/go.mod b/go.mod index 692a32c..2c03dbf 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module promgithub -go 1.22.5 +go 1.23.2 require ( github.com/gorilla/mux v1.8.1 From 6873b4bac9c1dd4f2ca40a7d3196bd3eed149feb Mon Sep 17 00:00:00 2001 From: Abhishek Rai Date: Mon, 4 Nov 2024 08:30:10 -0800 Subject: [PATCH 2/2] chore: Update linter version Signed-off-by: Abhishek Rai --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e2150b4..509e233 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -41,9 +41,9 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@v3 with: - version: v1.59.1 + version: v1.61.0 only-new-issues: true - args: --timeout=30m --config=./.golangci.yaml --out-format=colored-line-number + args: --config=./.golangci.yaml --out-format=colored-line-number - name: Build run: make build