]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: remove version string
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 28 Jan 2021 16:23:39 +0000 (17:23 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 28 Jan 2021 16:23:39 +0000 (17:23 +0100)
This is what modules are for, and Go binaries can introspect.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Makefile
main.go
main_windows.go

index 1b77f869d5aea2f0f9e856fadf0624fc83b2edb7..223766ba929f17482557abc714ea4943f61dab8f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,10 +10,10 @@ MAKEFLAGS += --no-print-directory
 generate-version-and-build:
        @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \
        tag="$$(git describe --dirty 2>/dev/null)" && \
-       ver="$$(printf 'package device\nconst WireGuardGoVersion = "%s"\n' "$${tag#v}")" && \
-       [ "$$(cat device/version.go 2>/dev/null)" != "$$ver" ] && \
-       echo "$$ver" > device/version.go && \
-       git update-index --assume-unchanged device/version.go || true
+       ver="$$(printf 'package main\nconst Version = "%s"\n' "$$tag")" && \
+       [ "$$(cat version.go 2>/dev/null)" != "$$ver" ] && \
+       echo "$$ver" > version.go && \
+       git update-index --assume-unchanged version.go || true
        @$(MAKE) wireguard-go
 
 wireguard-go: $(wildcard *.go) $(wildcard */*.go)
diff --git a/main.go b/main.go
index 40c8070cf336ad869a18ab61a1ae364857445c2a..721a2ed6a22d0a48ea4e0875e35565666f5c2a53 100644 (file)
--- a/main.go
+++ b/main.go
@@ -55,7 +55,7 @@ func warning() {
 
 func main() {
        if len(os.Args) == 2 && os.Args[1] == "--version" {
-               fmt.Printf("wireguard-go v%s\n\nUserspace WireGuard daemon for %s-%s.\nInformation available at https://www.wireguard.com.\nCopyright (C) Jason A. Donenfeld <Jason@zx2c4.com>.\n", device.WireGuardGoVersion, runtime.GOOS, runtime.GOARCH)
+               fmt.Printf("wireguard-go v%s\n\nUserspace WireGuard daemon for %s-%s.\nInformation available at https://www.wireguard.com.\nCopyright (C) Jason A. Donenfeld <Jason@zx2c4.com>.\n", Version, runtime.GOOS, runtime.GOARCH)
                return
        }
 
@@ -141,7 +141,7 @@ func main() {
                fmt.Sprintf("(%s) ", interfaceName),
        )
 
-       logger.Verbosef("Starting wireguard-go version %s", device.WireGuardGoVersion)
+       logger.Verbosef("Starting wireguard-go version %s", Version)
 
        if err != nil {
                logger.Errorf("Failed to create TUN device: %v", err)
index 82a333d238df0f1e7c5640ac9e5d098e3354feb6..7835a177e55dfa20642ac1bf48b2f9fe4b9e594b 100644 (file)
@@ -34,7 +34,7 @@ func main() {
                device.LogLevelVerbose,
                fmt.Sprintf("(%s) ", interfaceName),
        )
-       logger.Verbosef("Starting wireguard-go version %s", device.WireGuardGoVersion)
+       logger.Verbosef("Starting wireguard-go version %s", Version)
 
        tun, err := tun.CreateTUN(interfaceName, 0)
        if err == nil {