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 <alex@buoyant.io>
This commit is contained in:
Alex Leong 2022-02-17 14:46:57 -08:00 committed by GitHub
parent 425a43def5
commit 5b0c8475ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 38 deletions

View File

@ -16,12 +16,13 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: container:
image: golang:1.17.3 image: ghcr.io/linkerd/dev:v7
options: --user root
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Go lint - name: Go lint
run: bin/lint --verbose --timeout=10m run: golangci-lint run --verbose --timeout=10m
go_format: go_format:
name: Go format name: Go format
timeout-minutes: 10 timeout-minutes: 10

View File

@ -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: To analyze and lint the Go code using golangci-lint, run:
```bash ```bash
bin/lint golangci-lint run
``` ```
#### Formatting #### Formatting

View File

@ -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 "$@"