mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-26 01:34:00 -04:00
* new-from-rev option is showing inconsistent results on circle and locally. This change moves to a custom command `script/lint.sh` that gets a list of added go files and pipes them to golangci-lint for testing. * Add a git fetch as a step before retrieving merge-base changes to fix the issue described at https://discuss.circleci.com/t/checkout-script-adds-commits-to-master-from-circle-branch/14194/2 * Moved source code out of GOPATH to ensure go mod support and reduce the risk of having golangci-lint trying to scan all of the files within GOPATH. This was an issue in the past, in changing it I found less OOM issues on circle.
7 lines
233 B
Bash
Executable File
7 lines
233 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CHANGED_FILES=$(git diff --name-status `git merge-base origin/master HEAD`...HEAD | grep '^A.*\.go$'| awk '{print $2}')
|
|
if [ ! -z "${CHANGED_FILES}" ]; then
|
|
echo $CHANGED_FILES | xargs -n1 golangci-lint run
|
|
fi
|