mirror of https://github.com/hashicorp/packer
circle-ci: update ci-lint steps (#9043)
* 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.pull/9059/head
parent
cc257387f1
commit
c9c0ee65d3
@ -0,0 +1,6 @@
|
||||
#!/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
|
||||
Loading…
Reference in new issue