Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: upgrade golang golangci-lint version (#15865)

Danny Xu59cc4dfdcd4b
diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml
index aed367e4e5..b02a8186e8 100644
--- a/.github/workflows/backend-tests.yml
+++ b/.github/workflows/backend-tests.yml
@@ -23,14 +23,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
- go-version: '1.24.1'
+ go-version: '1.24.2'
cache: false # Caching is slow.
- name: Verify go.mod is tidy
run: |
go mod tidy
git diff --exit-code
- # - name: Install
- # run: sudo apt-get install -y libkrb5-dev
- name: Run all tests
run: go test -p=16 -timeout 30m -ldflags "-w -s" -v ./backend/... | tee test.log; exit ${PIPESTATUS[0]}
- name: Pretty print tests running time
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index 9bc3a3a726..bf0fde654f 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -23,12 +23,10 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
- go-version: '1.24.1'
+ go-version: '1.24.2'
cache: false # Caching is slow.
- # - name: Install
- # run: sudo apt-get install -y libkrb5-dev
- name: golangci-lint
uses: golangci/golangci-lint-action@v7
with:
- version: v2.0.1
+ version: v2.1.2
args: --verbose -j 8 --timeout 30m --max-same-issues=30 --allow-parallel-runners
\ No newline at end of file
diff --git a/.github/workflows/test_link.yml b/.github/workflows/test_link.yml
index bdcbb9ac85..dc7225ca4c 100644
--- a/.github/workflows/test_link.yml
+++ b/.github/workflows/test_link.yml
@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
- go-version: '1.24.1'
+ go-version: '1.24.2'
cache: false # Caching is slow.
- name: Validate links
run: go test -timeout 600s -v ./scripts/... | tee test.log; exit ${PIPESTATUS[0]}
diff --git a/go.mod b/go.mod
index babeef8ae4..ff2b98e460 100644
--- a/go.mod
+++ b/go.mod
@@ -2,7 +2,7 @@ module github.com/bytebase/bytebase
go 1.24.0
-toolchain go1.24.1
+toolchain go1.24.2
// workaround mssql-docker default TLS cert negative serial number problem
// https://github.com/microsoft/mssql-docker/issues/895
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 1071e33a50..d74d11c94e 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:22.14.0 as frontend
+FROM node:22.14.0 AS frontend
RUN npm i -g [email protected]
@@ -9,7 +9,7 @@ COPY . .
RUN pnpm --dir ./frontend i
RUN pnpm --dir ./frontend release-docker
-FROM golang:1.24.1 as backend
+FROM golang:1.24.2 AS backend
ADD go.mod go.sum /
RUN go mod download
@@ -18,12 +18,13 @@ ARG VERSION
ARG GIT_COMMIT
ARG RELEASE="release"
+RUN apt-get update
RUN if [ "$TARGETARCH" = "arm64" ]; then \
apt-get install -y gcc-aarch64-linux-gnu; \
else \
apt-get install -y gcc ;\
fi
-RUN apt-get update && apt-get install -y libkrb5-dev
+RUN apt-get install -y libkrb5-dev
WORKDIR /backend-build
@@ -41,12 +42,12 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARG
-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase ./backend/bin/server/main.go
-# Use debian to decompress tar files.
-FROM debian:bookworm-slim as decompressor
+FROM debian:bookworm-slim AS decompressor
ARG TARGETARCH
-RUN apt-get update && apt-get install -y xz-utils
+RUN apt-get update
+RUN apt-get install -y xz-utils
COPY ./backend/resources /tmp/bytebase/resources/
# These paths must match the paths in backened/resources/utils/utils_dir.go.
# The real resource dir is decided by the backend at runtime. But we can only extract these at build time.
@@ -57,7 +58,7 @@ RUN mkdir -p /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16
RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16/
# Use debian because mysql requires glibc.
-FROM debian:bookworm-slim as monolithic
+FROM debian:bookworm-slim AS monolithic
ARG TARGETARCH
ARG VERSION
@@ -74,8 +75,8 @@ RUN mkdir -p /var/opt/bytebase
# Directory to store the demo data.
RUN mkdir -p /var/opt/bytebase/pgdata-demo
# Our HEALTHCHECK instruction in dockerfile needs curl.
-# Install psmisc to use killall command in demo.sh used by render.com.
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales curl psmisc procps libncurses5 krb5-user libkrb5-dev
+RUN apt-get update
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales curl psmisc procps libncurses5 krb5-user libkrb5-dev
# Generate en_US.UTF-8 locale which is needed to start postgres server.
# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
@@ -91,7 +92,7 @@ COPY --from=backend /backend-build/bytebase /usr/local/bin/
COPY --from=backend /etc/ssl/certs /etc/ssl/certs
COPY --from=decompressor /var/opt/bytebase/resources /bytebase/resources
-ENV OPENSSL_CONF /etc/ssl/
+ENV OPENSSL_CONF=/etc/ssl/
CMD ["--port", "8080", "--data", "/var/opt/bytebase"]
diff --git a/scripts/Dockerfile.action b/scripts/Dockerfile.action
index 36c6bcd6d0..5f88df2a69 100644
--- a/scripts/Dockerfile.action
+++ b/scripts/Dockerfile.action
@@ -1,10 +1,10 @@
-FROM golang:latest AS builder
+FROM golang:1.24.2-alpine3.21 AS builder
WORKDIR /action-build
COPY action/ action/
COPY . .
RUN go build -o bytebase-action action/*.go
-FROM debian:12-slim
+FROM alpine:3.21
WORKDIR /
COPY --from=builder /action-build/bytebase-action /usr/local/bin/bytebase-action
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
diff --git a/scripts/Dockerfile.aws b/scripts/Dockerfile.aws
index 21d94ac857..716aeb35e0 100644
--- a/scripts/Dockerfile.aws
+++ b/scripts/Dockerfile.aws
@@ -1,4 +1,4 @@
-FROM node:22.14.0 as frontend
+FROM node:22.14.0 AS frontend
RUN npm i -g [email protected]
@@ -9,7 +9,7 @@ COPY . .
RUN pnpm --dir ./frontend i
RUN pnpm --dir ./frontend release-aws
-FROM golang:1.24.1 as backend
+FROM golang:1.24.2 AS backend
ADD go.mod go.sum /
RUN go mod download
@@ -18,12 +18,13 @@ ARG VERSION
ARG GIT_COMMIT
ARG RELEASE="release"
+RUN apt-get update
RUN if [ "$TARGETARCH" = "arm64" ]; then \
apt-get install -y gcc-aarch64-linux-gnu; \
else \
apt-get install -y gcc ;\
fi
-RUN apt-get update && apt-get install -y libkrb5-dev
+RUN apt-get install -y libkrb5-dev
WORKDIR /backend-build
@@ -41,12 +42,12 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARG
-ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase ./backend/bin/server/main.go
-# Use debian to decompress tar files.
-FROM debian:bookworm-slim as decompressor
+FROM debian:bookworm-slim AS decompressor
ARG TARGETARCH
-RUN apt-get update && apt-get install -y xz-utils
+RUN apt-get update
+RUN apt-get install -y xz-utils
COPY ./backend/resources /tmp/bytebase/resources/
# These paths must match the paths in backened/resources/utils/utils_dir.go.
# The real resource dir is decided by the backend at runtime. But we can only extract these at build time.
@@ -57,7 +58,7 @@ RUN mkdir -p /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16
RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16/
# Use debian because mysql requires glibc.
-FROM debian:bookworm-slim as monolithic
+FROM debian:bookworm-slim AS monolithic
ARG TARGETARCH
ARG VERSION
@@ -74,8 +75,8 @@ RUN mkdir -p /var/opt/bytebase
# Directory to store the demo data.
RUN mkdir -p /var/opt/bytebase/pgdata-demo
# Our HEALTHCHECK instruction in dockerfile needs curl.
-# Install psmisc to use killall command in demo.sh used by render.com.
-RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales curl psmisc procps libncurses5 krb5-user libkrb5-dev
+RUN apt-get update
+RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales curl psmisc procps libncurses5 krb5-user libkrb5-dev
# Generate en_US.UTF-8 locale which is needed to start postgres server.
# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
@@ -91,7 +92,7 @@ COPY --from=backend /backend-build/bytebase /usr/local/bin/
COPY --from=backend /etc/ssl/certs /etc/ssl/certs
COPY --from=decompressor /var/opt/bytebase/resources /bytebase/resources
-ENV OPENSSL_CONF /etc/ssl/
+ENV OPENSSL_CONF=/etc/ssl/
ENV AWS_PRODUCT_ID="prod-n4dmmye4e6hjo"
CMD ["--port", "8080", "--data", "/var/opt/bytebase"]