From e4dcfeacd561fbbb630dce15d23124a8e87a5010 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Fri, 21 Jan 2022 20:39:28 -0800 Subject: [PATCH] Make linters happy --- Dockerfile.multi-stage | 4 ++-- main.go | 2 +- main_test.go | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Dockerfile.multi-stage b/Dockerfile.multi-stage index 5141762..d2d796a 100644 --- a/Dockerfile.multi-stage +++ b/Dockerfile.multi-stage @@ -1,9 +1,9 @@ ARG REPO=library FROM golang:1.12-alpine AS builder -RUN apk add --no-cache git=~2 +RUN apk add --no-cache git=~2 \ + && mkdir /app -RUN mkdir /app WORKDIR /app COPY ./go.mod ./go.sum /app/ diff --git a/main.go b/main.go index 9121480..a1876de 100644 --- a/main.go +++ b/main.go @@ -92,7 +92,7 @@ func main() { flag.BoolVar(&slog.DebugLevel, "debug", false, "Enables debug logs (default: false)") flag.BoolVar(&ExportMetrics, "metrics", false, "Enables prometheus metrics exporting (default: false)") flag.BoolVar(&PyCompat, "py-compat", false, "Enables support for legacy Python Minitor config. Will eventually be removed. (default: false)") - flag.IntVar(&MetricsPort, "metrics-port", 8080, "The port that Prometheus metrics should be exported on, if enabled. (default: 8080)") + flag.IntVar(&MetricsPort, "metrics-port", MetricsPort, "The port that Prometheus metrics should be exported on, if enabled. (default: 8080)") flag.Parse() // Print version if flag is provided diff --git a/main_test.go b/main_test.go index 3f780c9..9bc11d7 100644 --- a/main_test.go +++ b/main_test.go @@ -16,7 +16,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Success", Command: CommandOrShell{Command: []string{"true"}}, }, @@ -28,7 +28,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Failure", Command: CommandOrShell{Command: []string{"false"}}, AlertAfter: 1, @@ -41,7 +41,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Success", Command: CommandOrShell{Command: []string{"ls"}}, alertCount: 1, @@ -54,7 +54,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Failure", Command: CommandOrShell{Command: []string{"false"}}, AlertDown: []string{"unknown"}, @@ -68,7 +68,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Success", Command: CommandOrShell{Command: []string{"true"}}, AlertUp: []string{"unknown"}, @@ -82,7 +82,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Failure", Command: CommandOrShell{Command: []string{"false"}}, AlertDown: []string{"good"}, @@ -90,7 +90,7 @@ func TestCheckMonitors(t *testing.T) { }, }, Alerts: map[string]*Alert{ - "good": &Alert{ + "good": { Command: CommandOrShell{Command: []string{"true"}}, }, }, @@ -101,7 +101,7 @@ func TestCheckMonitors(t *testing.T) { { config: Config{ Monitors: []*Monitor{ - &Monitor{ + { Name: "Failure", Command: CommandOrShell{Command: []string{"false"}}, AlertDown: []string{"bad"}, @@ -109,7 +109,7 @@ func TestCheckMonitors(t *testing.T) { }, }, Alerts: map[string]*Alert{ - "bad": &Alert{ + "bad": { Name: "bad", Command: CommandOrShell{Command: []string{"false"}}, },