Add linting (#23)

Adds linting and fixes a couple of linting issues. Closes #6.
This commit is contained in:
Thomas Stringer 2022-06-29 21:02:36 -04:00 committed by GitHub
parent 14ea447010
commit 816ea3dd2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -22,3 +22,5 @@ jobs:
VERSION: latest
- name: Test
run: make test
- name: Lint
run: make lint

View file

@ -19,3 +19,7 @@ push:
.PHONY: test
test:
go test -v .
.PHONY: lint
lint:
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:v1.46.2 golangci-lint run -v

View file

@ -13,7 +13,7 @@ import (
"golang.org/x/oauth2"
)
func handleInterrupt(client *github.Client, ctx context.Context, apprv *approvalEnvironment) {
func handleInterrupt(ctx context.Context, client *github.Client, apprv *approvalEnvironment) {
newState := "closed"
closeComment := "Workflow cancelled, closing issue."
fmt.Println(closeComment)
@ -158,8 +158,8 @@ func main() {
select {
case exitCode := <-commentLoopChannel:
os.Exit(exitCode)
case _ = <-killSignalChannel:
handleInterrupt(client, ctx, apprv)
case <-killSignalChannel:
handleInterrupt(ctx, client, apprv)
os.Exit(1)
}
}