Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: run golangci-lint for all codes #15

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions dapper/validate
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

cd "$(dirname "$0")"/..
cd $(dirname $0)/..

echo Running validation

Expand All @@ -11,21 +11,8 @@ echo Running: go vet
# shellcheck disable=SC2086
go vet ${PACKAGES}

if [ ! -z "${DRONE_REPO}" ] && [ ! -z "${DRONE_PULL_REQUEST}" ]; then
curl -sSfLO https://github.com/"$DRONE_REPO"/pull/"$DRONE_PULL_REQUEST".patch
echo "Running: golangci-lint run --new-from-patch=${DRONE_PULL_REQUEST}.patch"
golangci-lint run --new-from-patch="${DRONE_PULL_REQUEST}.patch"
rm "${DRONE_PULL_REQUEST}.patch"
elif [ -n "${DRONE_COMMIT_REF}" ]; then
echo "Running: golangci-lint run --new-from-rev=${DRONE_COMMIT_REF}"
golangci-lint run --new-from-rev="${DRONE_COMMIT_REF}"
else
git symbolic-ref -q HEAD && REV="origin/HEAD" || REV="HEAD^"
headSHA=$(git rev-parse --short=12 ${REV})
echo "Running: golangci-lint run --new-from-rev=${headSHA}"
golangci-lint run --new-from-rev="${headSHA}"
fi

echo Running: golangci-lint
golangci-lint run --timeout=5m

echo Running: go fmt
test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)"