summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-debug/debug.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2022-04-26 20:30:25 -0700
committerLibravatar Terin Stock <terinjokes@gmail.com>2023-01-31 15:16:42 +0100
commit83b4c9ebc87d0fddf4e638f13e3af1483912e3a5 (patch)
tree47840b84c0fd3cb226eab2ecb3dbce0617163406 /vendor/codeberg.org/gruf/go-debug/debug.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-83b4c9ebc87d0fddf4e638f13e3af1483912e3a5.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/codeberg.org/gruf/go-debug/debug.go')
-rw-r--r--vendor/codeberg.org/gruf/go-debug/debug.go58
1 files changed, 0 insertions, 58 deletions
diff --git a/vendor/codeberg.org/gruf/go-debug/debug.go b/vendor/codeberg.org/gruf/go-debug/debug.go
deleted file mode 100644
index 6b5e56548..000000000
--- a/vendor/codeberg.org/gruf/go-debug/debug.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package debug
-
-import (
- _debug "runtime/debug"
-)
-
-// DEBUG returns whether debugging is enabled.
-func DEBUG() bool {
- return debug
-}
-
-// Run will only call fn if DEBUG is enabled.
-func Run(fn func()) {
- if debug {
- fn()
- }
-}
-
-// BuildInfo will return a useful new-line separated build info string for current binary, setting name as given value.
-func BuildInfo(name string) string {
- // Read build info from current binary
- build, ok := _debug.ReadBuildInfo()
- if !ok {
- return "name=" + name + "\n"
- }
-
- var flags, vcs, commit, time string
-
- // Parse build information from BuildInfo.Settings
- for i := 0; i < len(build.Settings); i++ {
- switch build.Settings[i].Key {
- case "-gcflags":
- flags += ` -gcflags="` + build.Settings[i].Value + `"`
- case "-ldflags":
- flags += ` -ldflags="` + build.Settings[i].Value + `"`
- case "-tags":
- flags += ` -tags="` + build.Settings[i].Value + `"`
- case "vcs":
- vcs = build.Settings[i].Value
- case "vcs.revision":
- commit = build.Settings[i].Value
- if len(commit) > 8 {
- commit = commit[:8]
- }
- case "vcs.time":
- time = build.Settings[i].Value
- }
- }
-
- return "" +
- "name=" + name + "\n" +
- "vcs=" + vcs + "\n" +
- "commit=" + commit + "\n" +
- "version=" + build.Main.Version + "\n" +
- "path=" + build.Path + "\n" +
- "build=" + build.GoVersion + flags + "\n" +
- "time=" + time + "\n"
-}