diff --git a/.golangci.yml b/.golangci.yml index 5c0378c..3f099fe 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,6 +2,7 @@ version: "2" linters: enable: - sloglint + - revive settings: errcheck: exclude-functions: diff --git a/README.md b/README.md index 6b571c4..585ff8e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Consul Exporter -[][circleci] +[](https://github.com/prometheus/consul_exporter/actions/workflows/ci.yml) [][quay] [][hub] @@ -133,6 +133,5 @@ To use TLS and/or basic authentication, you need to pass a configuration file using the `--web.config.file` parameter. The format of the file is described [in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md). -[circleci]: https://circleci.com/gh/prometheus/consul_exporter [hub]: https://hub.docker.com/r/prom/consul-exporter/ [quay]: https://quay.io/repository/prometheus/consul-exporter diff --git a/cmd/consul_exporter/consul_exporter.go b/cmd/consul_exporter/consul_exporter.go index 5ef2ce3..88ea7e0 100644 --- a/cmd/consul_exporter/consul_exporter.go +++ b/cmd/consul_exporter/consul_exporter.go @@ -89,7 +89,7 @@ func main() { } prometheus.MustRegister(exporter) - queryOptionsJson, err := json.MarshalIndent(queryOptions, "", " ") + queryOptionsJSON, err := json.MarshalIndent(queryOptions, "", " ") if err != nil { logger.Error("Error marshaling query options", "err", err) os.Exit(1) @@ -108,25 +108,25 @@ func main() { ), ), ) - http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { w.Write([]byte(`
` + string(queryOptionsJson) + `+
` + string(queryOptionsJSON) + `
` + version.Info() + ` ` + version.BuildContext() + ``)) }) - http.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/-/healthy", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) fmt.Fprintf(w, "OK") }) - http.HandleFunc("/-/ready", func(w http.ResponseWriter, r *http.Request) { + http.HandleFunc("/-/ready", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) fmt.Fprintf(w, "OK") }) diff --git a/pkg/exporter/consul_exporter.go b/pkg/exporter/consul_exporter.go index 7eb10c6..69d502e 100644 --- a/pkg/exporter/consul_exporter.go +++ b/pkg/exporter/consul_exporter.go @@ -17,7 +17,6 @@ import ( "fmt" "log/slog" "net/http" - _ "net/http/pprof" "net/url" "regexp" "strconv"