From 55dca92b790ab0c9756006c3a078307cf04a0fcf Mon Sep 17 00:00:00 2001 From: Galorhallen Date: Tue, 25 Oct 2022 09:43:34 +0200 Subject: [PATCH] Print go version at startup --- .gitignore | 1 + config/configuration.go | 8 +++++--- go.mod | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 20caf56..27ec8c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ vendor bin tmp + .vscode report.xml debug diff --git a/config/configuration.go b/config/configuration.go index 4fe187e..c8763ab 100644 --- a/config/configuration.go +++ b/config/configuration.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "reflect" + "runtime" "strings" "time" @@ -89,7 +90,7 @@ func (c *Config) String() string { return fmt.Sprintf("", &c, strings.Join(buffer, ", ")) } -//Validate check if the config is valid +// Validate check if the config is valid func (c Config) Validate() error { if c.PIHoleProtocol != "http" && c.PIHoleProtocol != "https" { return fmt.Errorf("protocol %s is invalid. Must be http or https", c.PIHoleProtocol) @@ -175,12 +176,12 @@ func (c Config) hostnameURL() string { return s } -//PIHoleStatsURL returns the stats url +// PIHoleStatsURL returns the stats url func (c Config) PIHoleStatsURL() string { return c.hostnameURL() + "/admin/api.php?summaryRaw&overTimeData&topItems&recentItems&getQueryTypes&getForwardDestinations&getQuerySources&jsonForceObject" } -//PIHoleLoginURL returns the login url +// PIHoleLoginURL returns the login url func (c Config) PIHoleLoginURL() string { return c.hostnameURL() + "/admin/index.php?login" } @@ -190,6 +191,7 @@ func (c EnvConfig) show() { log.Println("------------------------------------") log.Println("- PI-Hole exporter configuration -") log.Println("------------------------------------") + log.Printf("Go version: %s", runtime.Version()) for i := 0; i < val.NumField(); i++ { valueField := val.Field(i) typeField := val.Type().Field(i) diff --git a/go.mod b/go.mod index d1e5fa2..fe9fc69 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/eko/pihole-exporter -go 1.17 +go 1.19 require ( github.com/heetch/confita v0.10.0