summaryrefslogtreecommitdiff
path: root/lib/debug/debug.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-23 01:04:38 +0700
committerShulhan <ms@kilabit.info>2025-01-23 01:04:38 +0700
commitb095a40ba34df4c0ce8fb9e8f1b68fef2b336956 (patch)
tree0c9b3b3dc3c3dbced9cd93580bf321e5bba6a52e /lib/debug/debug.go
parent7041153f3c1f464464cbf8faf7541821dc33e14d (diff)
downloadpakakeh.go-b095a40ba34df4c0ce8fb9e8f1b68fef2b336956.tar.xz
lib/debug: remove the global Value variable
Using global variable inside one package is a mistake. If, for example, package X set debug.Value to 1, another packages that does need to be debugged will print unnecessary log messages.
Diffstat (limited to 'lib/debug/debug.go')
-rw-r--r--lib/debug/debug.go22
1 files changed, 2 insertions, 20 deletions
diff --git a/lib/debug/debug.go b/lib/debug/debug.go
index df3cf9d8..790db417 100644
--- a/lib/debug/debug.go
+++ b/lib/debug/debug.go
@@ -2,24 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package debug provide global debug variable, initialized through
-// environment variable "DEBUG" or directly.
+// Package debug provide library for profiling Go program.
+// Its a wrapper for standard [runtime] and [runtime/pprof] packages.
package debug
-
-import (
- "os"
- "strconv"
-)
-
-var (
- // Value contains DEBUG value from environment.
- Value = 0
-)
-
-// init initialize debug from system environment.
-func init() {
- v := os.Getenv("DEBUG")
- if len(v) > 0 {
- Value, _ = strconv.Atoi(v)
- }
-}