go.mod,internal/worker: fix minor issues

Merge require sections in go.mod.

Fix staticcheck error.

Run staticcheck and unparam only on go 1.17.
Both tools fail at tip (not necessarily their fault).

Fetch all go binaries at latest instead of master,
since we are only running them on released Go versions.

Change-Id: I86f242713c0ae29f0c2a7d85b72882ada680ab83
Reviewed-on: https://go-review.googlesource.com/c/vuln/+/371334
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/checks.bash b/checks.bash
index 3195612..6bf9151 100755
--- a/checks.bash
+++ b/checks.bash
@@ -23,7 +23,7 @@
   if ! [ -x "$(command -v $binary)" ]; then
     info "Installing: $1"
     # Install the binary in a way that doesn't affect our go.mod file.
-    go install $1@master
+    go install $1@latest
   fi
 }
 
@@ -61,8 +61,10 @@
 
 # check_unparam runs unparam on source files.
 check_unparam() {
-  ensure_go_binary mvdan.cc/unparam
-  runcmd unparam ./...
+  if [[ $(go version) = *go1.17* ]]; then
+    ensure_go_binary mvdan.cc/unparam
+    runcmd unparam ./...
+  fi
 }
 
 # check_vet runs go vet on source files.
@@ -72,8 +74,10 @@
 
 # check_staticcheck runs staticcheck on source files.
 check_staticcheck() {
-  ensure_go_binary honnef.co/go/tools/cmd/staticcheck
-  runcmd staticcheck ./...
+  if [[ $(go version) = *go1.17* ]]; then
+    ensure_go_binary honnef.co/go/tools/cmd/staticcheck
+    runcmd staticcheck ./...
+  fi
 }
 
 # check_misspell runs misspell on source files.
@@ -86,8 +90,7 @@
   check_vet
   check_staticcheck
   check_misspell
-  # Commented out pending https://github.com/mvdan/unparam/issues/59.
-  # check_unparam
+  check_unparam
 }
 
 go_modtidy() {
diff --git a/go.mod b/go.mod
index e948ad5..7164e11 100644
--- a/go.mod
+++ b/go.mod
@@ -23,6 +23,7 @@
 	github.com/golang/protobuf v1.5.2 // indirect
 	github.com/google/go-cmp v0.5.6
 	github.com/google/go-github v17.0.0+incompatible
+	github.com/google/go-querystring v1.1.0 // indirect
 	github.com/google/safehtml v0.0.2
 	github.com/googleapis/gax-go/v2 v2.1.1 // indirect
 	github.com/imdario/mergo v0.3.12 // indirect
@@ -52,5 +53,3 @@
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 	gopkg.in/yaml.v2 v2.4.0
 )
-
-require github.com/google/go-querystring v1.1.0 // indirect
diff --git a/internal/worker/server.go b/internal/worker/server.go
index 6bd1ee2..0bc3480 100644
--- a/internal/worker/server.go
+++ b/internal/worker/server.go
@@ -116,7 +116,7 @@
 	return fmt.Sprintf("%d (%s): %v", s.status, http.StatusText(s.status), s.err)
 }
 
-func (s *Server) serveError(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) {
+func (s *Server) serveError(ctx context.Context, w http.ResponseWriter, _ *http.Request, err error) {
 	serr, ok := err.(*serverError)
 	if !ok {
 		serr = &serverError{status: http.StatusInternalServerError, err: err}
@@ -261,7 +261,7 @@
 	if s.issueClient == nil {
 		return &serverError{
 			status: http.StatusPreconditionFailed,
-			err:    errors.New("Issue creation disabled."),
+			err:    errors.New("issue creation disabled"),
 		}
 	}
 	limit := 0