From 160c534835e02a86f4c5a68730995c858eae36c2 Mon Sep 17 00:00:00 2001 From: Markus Opolka Date: Mon, 4 May 2026 09:40:19 +0200 Subject: [PATCH] Merge version.go into main.go to simplify repo structure --- main.go | 38 ++++++++++++++++++++++++++++---------- version.go | 28 ---------------------------- 2 files changed, 28 insertions(+), 38 deletions(-) delete mode 100644 version.go diff --git a/main.go b/main.go index da5d8bc..6184b6a 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,16 @@ import ( "github.com/NETWAYS/go-check" ) -const readme = `Icinga check plugin to run checks and other commands directly on +// nolint: gochecknoglobals +var ( + // These get filled at build time with the proper vaules. + version = "development" + commit = "HEAD" + date = "latest" +) + +const readme = ` +Icinga check plugin to run checks and other commands directly on any Windows system using WinRM (Windows Remote Management) and Powershell Main use case would be to call one of the plugins from the Icinga Powershell Framework. @@ -17,14 +26,6 @@ This will avoid the requirement of installing an Icinga 2 agent on every Windows The plugin will require WinRM to be preconfigured for access with a HTTPs or HTTP connection. -Supported authentication methods: - -* Basic with local users -* NTLM with local or AD accounts -* TLS client certificate - -https://github.com/Netways/check_by_powershell - Copyright (c) 2026 Netways GmbH Copyright (c) 2020-2026 Icinga GmbH @@ -39,7 +40,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see https://www.gnu.org/licenses/.` +along with this program. If not, see https://www.gnu.org/licenses/. +` func main() { defer check.CatchPanic() @@ -72,3 +74,19 @@ func main() { fmt.Print(output) os.Exit(rc) } + +func buildVersion() string { + result := version + + if commit != "" { + result = fmt.Sprintf("%s\ncommit: %s", result, commit) + } + + if date != "" { + result = fmt.Sprintf("%s\ndate: %s", result, date) + } + + result += "\n" + readme + + return result +} diff --git a/version.go b/version.go deleted file mode 100644 index 5d9dc9f..0000000 --- a/version.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -// default vars set by goreleaser -// https://goreleaser.com/customization/build/ -var ( - version = "0.4.0" - commit string - date string - builtBy string -) - -func buildVersion() string { - s := version - - if commit != "" { - s += " - " + commit - } - - if date != "" { - s += " (" + date + ")" - } - - if builtBy != "" { - s += " (built by " + builtBy + ")" - } - - return s -}