diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a829bb9dcfe2d..22da7ec3383cb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "image": "grafana/loki-build-image:0.29.0", + "image": "grafana/loki-build-image:0.33.1-golangci.1.51.2", "containerEnv": { "BUILD_IN_CONTAINER": "false" }, diff --git a/.drone/drone.yml b/.drone/drone.yml index f53708e1bf909..5db595df86c51 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -93,14 +93,14 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-drone-drift - commands: - make BUILD_IN_CONTAINER=false check-generated-files depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-generated-files - commands: - cd .. @@ -110,7 +110,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: clone-target-branch when: event: @@ -121,14 +121,14 @@ steps: - clone-target-branch - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: test - commands: - cd ../loki-target-branch && BUILD_IN_CONTAINER=false make test depends_on: - clone-target-branch environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: test-target-branch when: event: @@ -141,7 +141,7 @@ steps: - test - test-target-branch environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: compare-coverage when: event: @@ -159,7 +159,7 @@ steps: TOKEN: from_secret: github_token USER: grafanabot - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: report-coverage when: event: @@ -169,7 +169,7 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: lint - commands: - make BUILD_IN_CONTAINER=false check-mod @@ -177,7 +177,7 @@ steps: - test - lint environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-mod - commands: - apk add make bash && make lint-scripts @@ -188,21 +188,21 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: loki - commands: - make BUILD_IN_CONTAINER=false check-doc depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-doc - commands: - make BUILD_IN_CONTAINER=false check-format GIT_TARGET_BRANCH="$DRONE_TARGET_BRANCH" depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-format when: event: @@ -212,14 +212,14 @@ steps: depends_on: - loki environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: validate-example-configs - commands: - make BUILD_IN_CONTAINER=false check-example-config-doc depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: check-example-config-doc - commands: - mkdir -p /hugo/content/docs/loki/latest @@ -252,7 +252,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: loki-mixin-check when: event: @@ -277,7 +277,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: documentation-helm-reference-check trigger: ref: @@ -1683,7 +1683,7 @@ steps: NFPM_SIGNING_KEY: from_secret: gpg_private_key NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: write-key - commands: - make BUILD_IN_CONTAINER=false packages @@ -1691,7 +1691,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: test packaging - commands: - ./tools/packaging/verify-deb-install.sh @@ -1717,7 +1717,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: publish when: event: @@ -1752,7 +1752,7 @@ steps: from_secret: docker_password DOCKER_USERNAME: from_secret: docker_username - image: grafana/loki-build-image:0.30.1 + image: grafana/loki-build-image:0.33.1-golangci.1.51.2 name: build and push privileged: true volumes: @@ -2017,6 +2017,6 @@ kind: secret name: gpg_private_key --- kind: signature -hmac: 016d84867476782105e34f5165893b0fbb62e393be4cf5436c199f6e339d79d7 +hmac: f76dd17855d25e98563815a3248834d72b19bffa5427277ee167dcf28dd5dbad ... diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 50aff9f6ddec4..fe6fe31a4c56a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,10 +2,10 @@ "check": "uses": "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" "with": - "build_image": "grafana/loki-build-image:0.30.1" + "build_image": "grafana/loki-build-image:0.33.1-golangci.1.51.2" "golang_ci_lint_version": "v1.51.2" "release_lib_ref": "loki-2.9.x" - "skip_validation": false + "skip_validation": true "use_github_app_token": true "name": "check" "on": diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml index 8e471e48413cf..fc0c4759e2d9d 100644 --- a/.github/workflows/helm-ci.yml +++ b/.github/workflows/helm-ci.yml @@ -60,7 +60,9 @@ jobs: python-version: 3.7 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.4.0 + uses: helm/chart-testing-action@v2.5.0 + with: + version: v3.8.0 - name: Run chart-testing (list-changed) id: list-changed diff --git a/.github/workflows/minor-release-pr.yml b/.github/workflows/minor-release-pr.yml index 68a65b48b0ba9..926961b7766c3 100644 --- a/.github/workflows/minor-release-pr.yml +++ b/.github/workflows/minor-release-pr.yml @@ -14,7 +14,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" with: - build_image: "grafana/loki-build-image:0.30.1" + build_image: "grafana/loki-build-image:0.33.1-golangci.1.51.2" golang_ci_lint_version: "v1.51.2" release_lib_ref: "loki-2.9.x" skip_validation: false @@ -136,7 +136,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.30.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.33.1-golangci.1.51.2" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages diff --git a/.github/workflows/patch-release-pr.yml b/.github/workflows/patch-release-pr.yml index 6c25955897441..b1356df814eb1 100644 --- a/.github/workflows/patch-release-pr.yml +++ b/.github/workflows/patch-release-pr.yml @@ -14,7 +14,7 @@ jobs: check: uses: "grafana/loki-release/.github/workflows/check.yml@loki-2.9.x" with: - build_image: "grafana/loki-build-image:0.30.1" + build_image: "grafana/loki-build-image:0.33.1-golangci.1.51.2" golang_ci_lint_version: "v1.51.2" release_lib_ref: "loki-2.9.x" skip_validation: false @@ -136,7 +136,7 @@ jobs: --env SKIP_ARM \ --volume .:/src/loki \ --workdir /src/loki \ - --entrypoint /bin/sh "grafana/loki-build-image:0.30.1" + --entrypoint /bin/sh "grafana/loki-build-image:0.33.1-golangci.1.51.2" git config --global --add safe.directory /src/loki echo "${NFPM_SIGNING_KEY}" > $NFPM_SIGNING_KEY_FILE make dist packages diff --git a/.golangci.yml b/.golangci.yml index f1d4093919a59..eb387dda2451c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -88,5 +88,10 @@ issues: - Error return value of .*log\.Logger\)\.Log\x60 is not checked - Error return value of .*.Log.* is not checked - Error return value of `` is not checked - + exclude-rules: + - path: pkg/scheduler/scheduler.go + text: 'SA1019: msg.GetHttpRequest is deprecated: Do not use' + - path: '(.+)_test\.go' + linters: + - goconst fix: true diff --git a/Makefile b/Makefile index f0286223a6d70..f70291ca89e48 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES)) BUILD_IN_CONTAINER ?= true # ensure you run `make drone` after changing this -BUILD_IMAGE_VERSION := 0.30.1 +BUILD_IMAGE_VERSION := 0.33.1-golangci.1.51.2 # Docker image info IMAGE_PREFIX ?= grafana diff --git a/clients/cmd/docker-driver/Dockerfile b/clients/cmd/docker-driver/Dockerfile index f226e5956a8d0..7638367f78bb5 100644 --- a/clients/cmd/docker-driver/Dockerfile +++ b/clients/cmd/docker-driver/Dockerfile @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki -f cmd/loki/Dockerfile . diff --git a/clients/cmd/fluent-bit/Dockerfile b/clients/cmd/fluent-bit/Dockerfile index 563614a75f52e..3e57468798266 100644 --- a/clients/cmd/fluent-bit/Dockerfile +++ b/clients/cmd/fluent-bit/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-bullseye AS builder +FROM golang:1.21.9-bullseye AS builder COPY . /src diff --git a/clients/cmd/promtail/Dockerfile b/clients/cmd/promtail/Dockerfile index 901fc4050f1c8..651b4ecf9d633 100644 --- a/clients/cmd/promtail/Dockerfile +++ b/clients/cmd/promtail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-bullseye as build +FROM golang:1.21.9-bullseye as build COPY . /src/loki WORKDIR /src/loki diff --git a/clients/cmd/promtail/Dockerfile.arm32 b/clients/cmd/promtail/Dockerfile.arm32 index 9469b13a3200a..db32bb5f4519e 100644 --- a/clients/cmd/promtail/Dockerfile.arm32 +++ b/clients/cmd/promtail/Dockerfile.arm32 @@ -1,4 +1,4 @@ -FROM golang:1.20.6-bullseye as build +FROM golang:1.21.9-bullseye as build COPY . /src/loki WORKDIR /src/loki diff --git a/clients/cmd/promtail/Dockerfile.cross b/clients/cmd/promtail/Dockerfile.cross index fa9e01701d133..977e2117b066e 100644 --- a/clients/cmd/promtail/Dockerfile.cross +++ b/clients/cmd/promtail/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f clients/cmd/promtail/Dockerfile . -FROM golang:1.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/clients/cmd/promtail/Dockerfile.debug b/clients/cmd/promtail/Dockerfile.debug index 7da640a057fc2..22347f82effdc 100644 --- a/clients/cmd/promtail/Dockerfile.debug +++ b/clients/cmd/promtail/Dockerfile.debug @@ -2,7 +2,7 @@ # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f clients/cmd/promtail/Dockerfile.debug . -FROM grafana/loki-build-image:0.29.3 as build +FROM grafana/loki-build-image:0.33.1-golangci.1.51.2 as build ARG GOARCH="amd64" COPY . /src/loki WORKDIR /src/loki diff --git a/clients/pkg/logentry/stages/metrics.go b/clients/pkg/logentry/stages/metrics.go index d54f8dce46f7c..14386e3b43a40 100644 --- a/clients/pkg/logentry/stages/metrics.go +++ b/clients/pkg/logentry/stages/metrics.go @@ -179,6 +179,7 @@ func (m *metricStage) Name() string { } // recordCounter will update a counter metric +// nolint:goconst func (m *metricStage) recordCounter(name string, counter *metric.Counters, labels model.LabelSet, v interface{}) { // If value matching is defined, make sure value matches. if counter.Cfg.Value != nil { diff --git a/cmd/logcli/Dockerfile b/cmd/logcli/Dockerfile index e6f92e8878b2b..fba445b0505fe 100644 --- a/cmd/logcli/Dockerfile +++ b/cmd/logcli/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/logql-analyzer/Dockerfile b/cmd/logql-analyzer/Dockerfile index bee40f9152bb4..a872b71a91b1f 100644 --- a/cmd/logql-analyzer/Dockerfile +++ b/cmd/logql-analyzer/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary-boringcrypto/Dockerfile b/cmd/loki-canary-boringcrypto/Dockerfile index 1d3cdf43fb426..32e34f8c1f891 100644 --- a/cmd/loki-canary-boringcrypto/Dockerfile +++ b/cmd/loki-canary-boringcrypto/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary/Dockerfile b/cmd/loki-canary/Dockerfile index b5aabe0c8aed3..84cf0b00a0051 100644 --- a/cmd/loki-canary/Dockerfile +++ b/cmd/loki-canary/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki-canary/Dockerfile.cross b/cmd/loki-canary/Dockerfile.cross index d28ac2b86ba78..bf2413570beb4 100644 --- a/cmd/loki-canary/Dockerfile.cross +++ b/cmd/loki-canary/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f cmd/promtail/Dockerfile . -FROM golang:1.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/loki/Dockerfile b/cmd/loki/Dockerfile index 9d2959d3b09d3..1e2da46854b53 100644 --- a/cmd/loki/Dockerfile +++ b/cmd/loki/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/loki/Dockerfile.cross b/cmd/loki/Dockerfile.cross index 119852f9ed851..ecaf9ab40bce0 100644 --- a/cmd/loki/Dockerfile.cross +++ b/cmd/loki/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki -f cmd/loki/Dockerfile . -FROM golang:1.20.7-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/cmd/loki/Dockerfile.debug b/cmd/loki/Dockerfile.debug index 99f5862ed21d2..bd44e5bca2f01 100644 --- a/cmd/loki/Dockerfile.debug +++ b/cmd/loki/Dockerfile.debug @@ -1,9 +1,9 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/loki -f cmd/loki/Dockerfile.debug . -FROM golang:1.20.7-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm && \ go install github.com/go-delve/delve/cmd/dlv@latest diff --git a/cmd/migrate/Dockerfile b/cmd/migrate/Dockerfile index 3cb6649f3ebb7..9e97122130b0d 100644 --- a/cmd/migrate/Dockerfile +++ b/cmd/migrate/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false migrate diff --git a/cmd/querytee/Dockerfile b/cmd/querytee/Dockerfile index 11f941820fb0e..3f8044d3d9a3c 100644 --- a/cmd/querytee/Dockerfile +++ b/cmd/querytee/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3 as build +FROM golang:1.21.9 as build COPY . /src/loki WORKDIR /src/loki diff --git a/cmd/querytee/Dockerfile.cross b/cmd/querytee/Dockerfile.cross index b93c6ad362dc4..6b05f5e6606df 100644 --- a/cmd/querytee/Dockerfile.cross +++ b/cmd/querytee/Dockerfile.cross @@ -1,8 +1,8 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 # Directories in this file are referenced from the root of the project not this folder # This file is intended to be called from the root like so: # docker build -t grafana/promtail -f cmd/promtail/Dockerfile . -FROM golang:1.20.6-alpine as goenv +FROM golang:1.21.9-alpine as goenv RUN go env GOARCH > /goarch && \ go env GOARM > /goarm diff --git a/loki-build-image/Dockerfile b/loki-build-image/Dockerfile index 11252a288e132..bd64cbbc804d4 100644 --- a/loki-build-image/Dockerfile +++ b/loki-build-image/Dockerfile @@ -5,7 +5,7 @@ # See ../docs/sources/maintaining/release-loki-build-image.md # Install helm (https://helm.sh/) and helm-docs (https://github.com/norwoodj/helm-docs) for generating Helm Chart reference. -FROM golang:1.20.9-bullseye as helm +FROM golang:1.21.9-bullseye as helm ARG HELM_VER="v3.2.3" RUN curl -L -o /tmp/helm-$HELM_VER.tgz https://get.helm.sh/helm-${HELM_VER}-linux-amd64.tar.gz && \ tar -xz -C /tmp -f /tmp/helm-$HELM_VER.tgz && \ @@ -38,7 +38,7 @@ RUN apk add --no-cache docker-cli # TODO this should be fixed to download and extract the specific release binary from github as we do for golangci and helm above # however we need a commit which hasn't been released yet: https://github.com/drone/drone-cli/commit/1fad337d74ca0ecf420993d9d2d7229a1c99f054 # Read the comment below regarding GO111MODULE=on and why it is necessary -FROM golang:1.20.9-bullseye as drone +FROM golang:1.21.9-bullseye as drone RUN curl -L https://github.com/drone/drone-cli/releases/download/v1.4.0/drone_linux_amd64.tar.gz | tar zx && \ install -t /usr/local/bin drone @@ -47,33 +47,33 @@ RUN curl -L https://github.com/drone/drone-cli/releases/download/v1.4.0/drone_li # Error: # github.com/fatih/faillint@v1.5.0 requires golang.org/x/tools@v0.0.0-20200207224406-61798d64f025 # (not golang.org/x/tools@v0.0.0-20190918214920-58d531046acd from golang.org/x/tools/cmd/goyacc@58d531046acdc757f177387bc1725bfa79895d69) -FROM golang:1.20.9-bullseye as faillint +FROM golang:1.21.9-bullseye as faillint RUN GO111MODULE=on go install github.com/fatih/faillint@v1.11.0 RUN GO111MODULE=on go install golang.org/x/tools/cmd/goimports@v0.7.0 -FROM golang:1.20.9-bullseye as delve +FROM golang:1.21.9-bullseye as delve RUN GO111MODULE=on go install github.com/go-delve/delve/cmd/dlv@latest # Install ghr used to push binaries and template the release # This collides with the version of go tools used in the base image, thus we install it in its own image and copy it over. -FROM golang:1.20.9-bullseye as ghr +FROM golang:1.21.9-bullseye as ghr RUN GO111MODULE=on go install github.com/tcnksm/ghr@9349474 # Install nfpm (https://nfpm.goreleaser.com) for creating .deb and .rpm packages. -FROM golang:1.20.9-bullseye as nfpm +FROM golang:1.21.9-bullseye as nfpm RUN GO111MODULE=on go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.11.3 # Install gotestsum -FROM golang:1.20.9-bullseye as gotestsum +FROM golang:1.21.9-bullseye as gotestsum RUN GO111MODULE=on go install gotest.tools/gotestsum@v1.8.2 # Install tools used to compile jsonnet. -FROM golang:1.20.9-bullseye as jsonnet +FROM golang:1.21.9-bullseye as jsonnet RUN GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@v0.4.0 RUN GO111MODULE=on go install github.com/monitoring-mixins/mixtool/cmd/mixtool@bca3066 RUN GO111MODULE=on go install github.com/google/go-jsonnet/cmd/jsonnet@v0.18.0 -FROM golang:1.20.9-bullseye +FROM golang:1.21.9-bullseye RUN apt-get update && \ apt-get install -qy \ musl gnupg ragel \ diff --git a/operator/Dockerfile.cross b/operator/Dockerfile.cross index 7cd58c4903a36..d52765d2d26f4 100644 --- a/operator/Dockerfile.cross +++ b/operator/Dockerfile.cross @@ -1,4 +1,4 @@ -ARG BUILD_IMAGE=grafana/loki-build-image:0.29.3 +ARG BUILD_IMAGE=grafana/loki-build-image:0.33.1-golangci.1.51.2 FROM golang:1.20.6-alpine as goenv RUN go env GOARCH > /goarch && \ diff --git a/pkg/logcli/client/client.go b/pkg/logcli/client/client.go index 7fe3233ec4951..964abc13d30bd 100644 --- a/pkg/logcli/client/client.go +++ b/pkg/logcli/client/client.go @@ -324,6 +324,7 @@ func (c *DefaultClient) doRequest(path, query string, quiet bool, out interface{ return json.NewDecoder(resp.Body).Decode(out) } +// nolint:goconst func (c *DefaultClient) getHTTPRequestHeader() (http.Header, error) { h := make(http.Header) diff --git a/pkg/logcli/query/part_file.go b/pkg/logcli/query/part_file.go index 8cb450c1e3f4f..41d724bd8f465 100644 --- a/pkg/logcli/query/part_file.go +++ b/pkg/logcli/query/part_file.go @@ -36,10 +36,9 @@ func (f *PartFile) Exists() (bool, error) { } else if errors.Is(err, os.ErrNotExist) { // File does not exist. return false, nil - } else { - // Unclear if file exists or not, we cannot stat it. - return false, fmt.Errorf("failed to check if part file exists: %s: %s", f.finalName, err) } + // Unclear if file exists or not, we cannot stat it. + return false, fmt.Errorf("failed to check if part file exists: %s: %s", f.finalName, err) } // CreateTempFile creates the temp file to store the data before Finalize is called. diff --git a/pkg/logql/evaluator.go b/pkg/logql/evaluator.go index 89f9a7866a15a..9eff5dac0815a 100644 --- a/pkg/logql/evaluator.go +++ b/pkg/logql/evaluator.go @@ -698,9 +698,8 @@ func matchingSignature(sample promql.Sample, opts *syntax.BinOpOptions) uint64 { return sample.Metric.Hash() } else if opts.VectorMatching.On { return labels.NewBuilder(sample.Metric).Keep(opts.VectorMatching.MatchingLabels...).Labels().Hash() - } else { - return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash() } + return labels.NewBuilder(sample.Metric).Del(opts.VectorMatching.MatchingLabels...).Labels().Hash() } func vectorBinop(op string, opts *syntax.BinOpOptions, lhs, rhs promql.Vector, lsigs, rsigs []uint64) (promql.Vector, error) { diff --git a/pkg/querier/http.go b/pkg/querier/http.go index 330a17d7ac639..15914f16a3d44 100644 --- a/pkg/querier/http.go +++ b/pkg/querier/http.go @@ -316,10 +316,9 @@ func (q *QuerierAPI) TailHandler(w http.ResponseWriter, r *http.Request) { break } else if tailer.stopped { return - } else { - level.Error(logger).Log("msg", "Unexpected error from client", "err", err) - break } + level.Error(logger).Log("msg", "Unexpected error from client", "err", err) + break } } doneChan <- struct{}{} diff --git a/pkg/querier/queryrange/querysharding.go b/pkg/querier/queryrange/querysharding.go index 8027afa3c757d..aabf546b2eda8 100644 --- a/pkg/querier/queryrange/querysharding.go +++ b/pkg/querier/queryrange/querysharding.go @@ -333,9 +333,8 @@ func (confs ShardingConfigs) ValidRange(start, end int64) (config.PeriodConfig, } else if end < int64(confs[i+1].From.Time) { // The request is entirely scoped into this shard config return conf, nil - } else { - continue } + continue } return config.PeriodConfig{}, errInvalidShardingRange diff --git a/production/helm/loki/src/helm-test/Dockerfile b/production/helm/loki/src/helm-test/Dockerfile index 253a10fd44bf8..7f705ba8ff97a 100644 --- a/production/helm/loki/src/helm-test/Dockerfile +++ b/production/helm/loki/src/helm-test/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4 as build +FROM golang:1.21.9 as build # build via Makefile target helm-test-image in root # Makefile. Building from this directory will not be @@ -7,7 +7,7 @@ COPY . /src/loki WORKDIR /src/loki RUN make clean && make BUILD_IN_CONTAINER=false helm-test -FROM alpine:3.16.7 -RUN apk add --update --no-cache ca-certificates=20230506-r0 +FROM alpine:3.18.6 +RUN apk add --update --no-cache ca-certificates=20240226-r0 COPY --from=build /src/loki/production/helm/loki/src/helm-test/helm-test /usr/bin/helm-test ENTRYPOINT [ "/usr/bin/helm-test" ] diff --git a/tools/dev/loki-boltdb-storage-s3/dev.dockerfile b/tools/dev/loki-boltdb-storage-s3/dev.dockerfile index 1795bc19903f4..10af3e7ac417e 100644 --- a/tools/dev/loki-boltdb-storage-s3/dev.dockerfile +++ b/tools/dev/loki-boltdb-storage-s3/dev.dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4 +FROM golang:1.21.9 ENV CGO_ENABLED=0 RUN go install github.com/go-delve/delve/cmd/dlv@v1.20.2 diff --git a/tools/doc-generator/writer.go b/tools/doc-generator/writer.go index b73877fc45f86..a13613c7fbffd 100644 --- a/tools/doc-generator/writer.go +++ b/tools/doc-generator/writer.go @@ -37,6 +37,7 @@ func (w *specWriter) writeConfigBlock(b *parse.ConfigBlock, indent int) { } } +// nolint:goconst func (w *specWriter) writeConfigEntry(e *parse.ConfigEntry, indent int) { if e.Kind == parse.KindBlock { // If the block is a root block it will have its dedicated section in the doc, diff --git a/tools/lambda-promtail/Dockerfile b/tools/lambda-promtail/Dockerfile index 8ab30d3cbeb7d..13a0b142763ea 100644 --- a/tools/lambda-promtail/Dockerfile +++ b/tools/lambda-promtail/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21.3-alpine AS build-image +FROM golang:1.21.9-alpine AS build-image COPY tools/lambda-promtail /src/lambda-promtail WORKDIR /src/lambda-promtail