Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Last active August 23, 2017 19:38
Show Gist options
  • Save ntakouris/e3da879b414e5e7c8f34f663c31d65e1 to your computer and use it in GitHub Desktop.
Save ntakouris/e3da879b414e5e7c8f34f663c31d65e1 to your computer and use it in GitHub Desktop.
stage('Test'){
//List all our project files with 'go list ./... | grep -v /vendor/ | grep -v github.com | grep -v golang.org'
//Push our project files relative to ./src
sh 'cd $GOPATH && go list ./... | grep -v /vendor/ | grep -v github.com | grep -v golang.org > projectPaths'
//Print them with 'awk '$0="./src/"$0' projectPaths' in order to get full relative path to $GOPATH
def paths = sh returnStdout: true, script: """awk '\$0="./src/"\$0' projectPaths"""
echo 'Vetting'
sh """cd $GOPATH && go tool vet ${paths}"""
echo 'Linting'
sh """cd $GOPATH && golint ${paths}"""
echo 'Testing'
sh """cd $GOPATH && go test -race -cover ${paths}"""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment