Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Fix lint detected by golangci-lint (#38)
Browse files Browse the repository at this point in the history
Fix a couple of lints detected by golangci-lint
  • Loading branch information
Crevil committed Oct 7, 2019
1 parent 6c6887b commit cc81c12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,16 @@ func main() {
readyMutex.RLock()
defer readyMutex.RUnlock()

if ready == true {
if ready {
w.WriteHeader(http.StatusOK)
} else {
w.WriteHeader(http.StatusServiceUnavailable)
}

w.Write([]byte(strconv.FormatBool(ready)))
_, err := w.Write([]byte(strconv.FormatBool(ready)))
if err != nil {
log.With("error", err).Errorf("Failed to write ready response: %v", err)
}
})

done := make(chan error, 1)
Expand All @@ -105,11 +108,9 @@ func main() {
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
select {
case sig := <-sigs:
log.Infof("Received os signal '%s'. Terminating...", sig)
done <- nil
}
sig := <-sigs
log.Infof("Received os signal '%s'. Terminating...", sig)
done <- nil
}()

go runAPIPolling(done, *snykAPIURL, *snykAPIToken, *snykOrganizations, secondDuration(*snykInterval), secondDuration(*requestTimeout))
Expand Down
1 change: 1 addition & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func TestRunAPIPolling_issuesTimeout(t *testing.T) {
calls++
// allow organizations call to succeed
if calls == 1 {
//nolint:errcheck
rw.Write([]byte(`{
"orgs": [{
"id": "id",
Expand Down

0 comments on commit cc81c12

Please sign in to comment.