From 5b0c8475eceb41ff85133d284fdf8f2dc59bc516 Mon Sep 17 00:00:00 2001 From: Alex Leong Date: Thu, 17 Feb 2022 14:46:57 -0800 Subject: [PATCH] Run lint action from the devcontainer, remove bin/lint script (#7895) Since the devcontainer provides stable versions of our tools, we can use it as a base image for our CI workflows. This change updates the Go linting job to use the published devcontainer image. Signed-off-by: Alex Leong --- .github/workflows/static_checks.yml | 5 +++-- BUILD.md | 2 +- bin/lint | 35 ----------------------------- 3 files changed, 4 insertions(+), 38 deletions(-) delete mode 100755 bin/lint diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 42c473b7c..91b4a5ed4 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -16,12 +16,13 @@ jobs: timeout-minutes: 10 runs-on: ubuntu-20.04 container: - image: golang:1.17.3 + image: ghcr.io/linkerd/dev:v7 + options: --user root steps: - name: Checkout code uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - name: Go lint - run: bin/lint --verbose --timeout=10m + run: golangci-lint run --verbose --timeout=10m go_format: name: Go format timeout-minutes: 10 diff --git a/BUILD.md b/BUILD.md index c494d1592..120852a28 100644 --- a/BUILD.md +++ b/BUILD.md @@ -262,7 +262,7 @@ That is equivalent to running `linkerd check` using the code on your branch. To analyze and lint the Go code using golangci-lint, run: ```bash -bin/lint +golangci-lint run ``` #### Formatting diff --git a/bin/lint b/bin/lint deleted file mode 100755 index 83256cffc..000000000 --- a/bin/lint +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env sh - -set -eu - -cd "$(pwd -P)" - -bindir=$( cd "${0%/*}" && pwd ) -rootdir=$( cd "$bindir"/.. && pwd ) -devcontainerdir=$( cd "$rootdir"/.devcontainer && pwd ) -targetbin=$rootdir/target/bin - -cd "$rootdir" - -exe= -if [ "$(uname -s)" = Darwin ]; then - # Darwin's uname doesn't support the -o flag so we short circuit here. - :; -elif [ "$(uname -o)" = Msys ]; then - exe=.exe -fi - -lintversion=$(sed -nE 's/^ARG GOLANGCI_LINT_VERSION=(v[^ ]+)/\1/p' "$devcontainerdir"/Dockerfile | head -n 1) -if [ -z "$lintversion" ]; then - echo "GOLANGCI_LINT_VERSION is not set in .devcontainer/Dockerfile" >&2 - exit 1 -fi -lintbin=$targetbin/.golangci-lint-"$lintversion"$exe - -if [ ! -f "$lintbin" ]; then - mkdir -p "$targetbin" - "$bindir"/scurl https://raw.githubusercontent.com/golangci/golangci-lint/"$lintversion"/install.sh | sh -s -- -b . "$lintversion" - mv ./golangci-lint$exe "$lintbin" -fi - -"$lintbin" run "$@"