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

Fix lint detected by golangci-lint #38

Merged
merged 2 commits into from
Oct 7, 2019
Merged
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
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