mirror of https://github.com/linkerd/linkerd2.git
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:
parent
425a43def5
commit
5b0c8475ec
|
@ -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
|
||||||
|
|
2
BUILD.md
2
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:
|
To analyze and lint the Go code using golangci-lint, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bin/lint
|
golangci-lint run
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Formatting
|
#### Formatting
|
||||||
|
|
35
bin/lint
35
bin/lint
|
@ -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 "$@"
|
|
Loading…
Reference in New Issue