Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Use golangci-lint #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
55 changes: 44 additions & 11 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,45 @@ tasks:


##########################################################
##################### linux 64 build #####################
##################### Linter - Linux #####################
##########################################################

- provisionerId: "{{ taskcluster.docker.provisionerId }}"
workerType: "{{ taskcluster.docker.workerType }}"
metadata:
name: "Lint generic-worker (platform independent)"
description: "This lints the source code of generic-worker"
owner: "{{ event.head.user.email }}" # the user who sent the pr/push e-mail will be inserted here
source: "{{ event.head.repo.url }}" # the repo where the pr came from will be inserted here
extra:
github:
# Events that will trigger this task
events:
- pull_request.*
- push
payload:
maxRunTime: 3600
image: golang
command:
- /bin/bash
- -vxec
- |
go get -d "github.com/taskcluster/generic-worker"
cd "${GOPATH}/src/github.com/taskcluster/generic-worker"
git remote add user '{{ event.head.repo.url }}'
git fetch --tags user
git checkout '{{ event.head.sha }}'
go get github.com/alecthomas/gometalinter
cd gw-codegen
go get -v
cd ..
go generate
go get -d -v -t ./...
"${GOPATH}/bin/gometalinter" --install
"${GOPATH}/bin/gometalinter" --deadline 10m $(go list ./... | grep -v /vendor/ | sed 's/github.com\/taskcluster\/generic-worker/./')

##########################################################
##################### Linux 64 build #####################
##########################################################

- provisionerId: "{{ taskcluster.docker.provisionerId }}"
Expand Down Expand Up @@ -76,15 +114,14 @@ tasks:
git remote add '{{ event.head.user.login }}' '{{ event.head.repo.url }}'
git fetch --tags '{{ event.head.user.login }}'
git checkout '{{ event.head.sha }}'
go get github.com/taskcluster/livelog github.com/gordonklaus/ineffassign
go get github.com/taskcluster/livelog
cd gw-codegen
go get -v
cd ..
go generate
go get -v -t ./...
test "$(git status --porcelain | wc -l)" == 0
GORACE=history_size=7 go test -v -race ./...
"${GOPATH}/bin/ineffassign" .
artifacts:
public/build/generic-worker-linux-amd64:
path: "/go/bin/generic-worker"
Expand Down Expand Up @@ -122,7 +159,7 @@ tasks:
- 'git remote add "{{ event.head.user.login }}" "{{ event.head.repo.url }}"'
- 'git fetch --tags "{{ event.head.user.login }}"'
- git checkout {{ event.head.sha }}
- go get github.com/taskcluster/livelog github.com/gordonklaus/ineffassign
- go get github.com/taskcluster/livelog
- cd gw-codegen
- go get -v
- cd ..
Expand All @@ -143,7 +180,6 @@ tasks:
- go test -v -race ./...
- set GW_TESTS_GENERATE_USERS=true
- go test -v -race
- ineffassign .
artifacts:
- path: public/build/generic-worker-windows-amd64.exe
expires: "{{ '2 weeks' | $fromNow }}"
Expand Down Expand Up @@ -189,7 +225,7 @@ tasks:
- 'git remote add "{{ event.head.user.login }}" "{{ event.head.repo.url }}"'
- 'git fetch --tags "{{ event.head.user.login }}"'
- git checkout {{ event.head.sha }}
- go get github.com/taskcluster/livelog github.com/gordonklaus/ineffassign
- go get github.com/taskcluster/livelog
- cd gw-codegen
- go get -v
- cd ..
Expand All @@ -210,7 +246,6 @@ tasks:
- go test -v ./...
- set GW_TESTS_GENERATE_USERS=true
- go test -v
- ineffassign .
artifacts:
- path: public/build/generic-worker-windows-386.exe
expires: "{{ '2 weeks' | $fromNow }}"
Expand Down Expand Up @@ -256,7 +291,7 @@ tasks:
- 'git remote add "{{ event.head.user.login }}" "{{ event.head.repo.url }}"'
- 'git fetch --tags "{{ event.head.user.login }}"'
- git checkout {{ event.head.sha }}
- go get github.com/taskcluster/livelog github.com/gordonklaus/ineffassign
- go get github.com/taskcluster/livelog
- cd gw-codegen
- go get -v
- cd ..
Expand All @@ -277,7 +312,6 @@ tasks:
- go test -v -race ./...
- set GW_TESTS_GENERATE_USERS=true
- go test -v -race
- ineffassign .
artifacts:
- path: public/build/generic-worker-windows-amd64.exe
expires: "{{ '2 weeks' | $fromNow }}"
Expand Down Expand Up @@ -332,7 +366,7 @@ tasks:
git fetch --tags '{{ event.head.user.login }}'
git checkout -f '{{ event.head.sha }}'
git clean -fdx
go get -u github.com/taskcluster/livelog github.com/gordonklaus/ineffassign
go get -u github.com/taskcluster/livelog
cd gw-codegen
go get
cd ..
Expand All @@ -342,7 +376,6 @@ tasks:
# output of wc command can contain spaces on darwin, so no quotes around expression
test $(git status --porcelain | wc -l) == 0
GORACE=history_size=7 go test -race -v ./...
ineffassign .
artifacts:
- path: public/build/generic-worker-darwin-amd64
expires: "{{ '2 weeks' | $fromNow }}"
Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ git clean -fdX
CGO_ENABLED=1 GORACE="history_size=7" go test -v -race -timeout 1h ./...
go vet ./...
golint ./...
go get github.com/gordonklaus/ineffassign
ineffassign .
go get github.com/alecthomas/gometalinter
gometalinter --install
gometalinter --deadline 10m $(go list ./... | grep -v /vendor/ | sed 's/github.com\/taskcluster\/generic-worker/./')

echo "Build successful!"
git status
Loading