From b28039372f89387e1b4e9fcb49fe4e2b833dc337 Mon Sep 17 00:00:00 2001 From: layou233 Date: Sun, 8 Jan 2023 11:07:55 +0800 Subject: [PATCH] feat: Add CGO hint to build information --- common/cgo_disabled.go | 8 ++++++++ common/cgo_enabled.go | 8 ++++++++ main.go | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 common/cgo_disabled.go create mode 100644 common/cgo_enabled.go diff --git a/common/cgo_disabled.go b/common/cgo_disabled.go new file mode 100644 index 0000000..08baf18 --- /dev/null +++ b/common/cgo_disabled.go @@ -0,0 +1,8 @@ +//go:build !cgo + +package common + +const ( + CGOEnabled = false + CGOHint = "disabled" +) diff --git a/common/cgo_enabled.go b/common/cgo_enabled.go new file mode 100644 index 0000000..b98a5ae --- /dev/null +++ b/common/cgo_enabled.go @@ -0,0 +1,8 @@ +//go:build cgo + +package common + +const ( + CGOEnabled = true + CGOHint = "enabled" +) diff --git a/main.go b/main.go index 80fe829..12397eb 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "syscall" "time" + "github.com/layou233/ZBProxy/common" "github.com/layou233/ZBProxy/config" "github.com/layou233/ZBProxy/console" "github.com/layou233/ZBProxy/service" @@ -30,8 +31,8 @@ func main() { / /__ | |_| | | | | | \ \ | |_| | / /\ \ / / /_____| |_____/ |_| |_| \_\ \_____/ /_/ \_\ /_/`)) color.HiGreen("Welcome to ZBProxy %s (%s)!\n", version.Version, version.CommitHash) - color.HiBlack("Build Information: %s, %s/%s\n", - runtime.Version(), runtime.GOOS, runtime.GOARCH) + color.HiBlack("Build Information: %s, %s/%s, CGO %s\n", + runtime.Version(), runtime.GOOS, runtime.GOARCH, common.CGOHint) go version.CheckUpdate() config.LoadConfig()