Skip to content

Commit

Permalink
feat: add golangci-lint and validate script
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed Jan 5, 2024
1 parent a599861 commit c4293d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ RUN export K8S_VERSION=1.24.2 && \
mkdir /usr/local/kubebuilder && \
tar -C /usr/local/kubebuilder --strip-components=1 -zvxf envtest-bins.tar.gz

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2

ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS
ENV DAPPER_SOURCE /go/src/github.com/harvester/vm-import-controller
ENV DAPPER_OUTPUT ./bin
Expand Down
1 change: 1 addition & 0 deletions scripts/ci
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ set -e

cd $(dirname $0)

./validate
./build
./test
18 changes: 18 additions & 0 deletions scripts/validate
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

cd $(dirname $0)/..

echo "Running validation"

if [[ -z "$(command -v golangci-lint)" ]]; then
echo "no golangci-lint available, using go fmt/vet instead"
echo "Running: go fmt"
go fmt ./...
echo "Running: go vet"
go vet -tags=test ./...
exit
fi

echo "Running: golangci-lint run"
golangci-lint run

0 comments on commit c4293d8

Please sign in to comment.