Skip to content

Commit

Permalink
golangci-lint update 1.56.2
Browse files Browse the repository at this point in the history
Signed-off-by: Navid Yaghoobi <[email protected]>
  • Loading branch information
navidys committed Mar 6, 2024
1 parent cf2dd6e commit 909ba46
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linters:
- interfacer
- scopelint
- gomoddirectives
- depguard
# deprecated
- varcheck
- deadcode
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ install.tools: .install.pre-commit .install.codespell .install.golangci-lint .in

.PHONY: .install.golangci-lint
.install.golangci-lint:
VERSION=1.51.1 ./hack/install_golangci.sh
VERSION=1.56.2 ./hack/install_golangci.sh

#=================================================
# Linting/Formatting/Code Validation targets
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ volumes and networks information.`,
Run: run,
}

func preRun(cmd *cobra.Command, args []string) error {
func preRun(cmd *cobra.Command, _ []string) error {
version.Version = buildVersion
version.Revision = buildRevision
version.Branch = buildBranch
Expand All @@ -51,7 +51,6 @@ func preRun(cmd *cobra.Command, args []string) error {
func run(cmd *cobra.Command, args []string) {
if err := exporter.Start(cmd, args); err != nil {
log.Panic(err.Error())
os.Exit(1)
}
}

Expand Down
2 changes: 2 additions & 0 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func NewPodmanCollector(logger log.Logger) (*PodmanCollector, error) {
if err != nil {
return nil, err
}

collectors[key] = collector
initiatedCollectors[key] = collector
}
Expand Down Expand Up @@ -136,6 +137,7 @@ func execute(name string, c Collector, ch chan<- prometheus.Metric, logger log.L
name,
"duration_seconds",
duration.Seconds())

success = 1
}

Expand Down
4 changes: 2 additions & 2 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// Start starts prometheus exporter.
func Start(cmd *cobra.Command, args []string) error {
func Start(cmd *cobra.Command, _ []string) error {
// setup exporter
promlogConfig := &promlog.Config{Level: &promlog.AllowedLevel{}}

Expand Down Expand Up @@ -64,7 +64,7 @@ func Start(cmd *cobra.Command, args []string) error {

level.Info(logger).Log("msg", "Starting podman-prometheus-exporter", "version", version.Info())
http.Handle(webTelemetryPath, newHandler(webDisableExporterMetrics, webMaxRequests, logger))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
w.Write([]byte(`<html>
<head><title>Podman Exporter</title></head>
<body>
Expand Down
7 changes: 4 additions & 3 deletions exporter/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ func newHandler(disableExporterMetrics bool, maxRequests int, logger log.Logger)
)
}

if innerHandler, err := h.innerHandler(); err != nil {
innerHandler, err := h.innerHandler()
if err != nil {
panic(fmt.Sprintf("Couldn't create metrics handler: %s", err))
} else {
h.unfilteredHandler = innerHandler
}

h.unfilteredHandler = innerHandler

return h
}

Expand Down

0 comments on commit 909ba46

Please sign in to comment.