chore(v2): vendor dependencies for offline/China builds
go mod vendor pins onnxruntime_go v1.12.1, Gio and the rest into v2/vendor so go run/build work without hitting proxy.golang.org (blocked/slow in China). Verified: CGO_ENABLED=1 go build -mod=vendor ./internal/spike and GOOS=windows go build -mod=vendor ./internal/ui both pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+57
@@ -0,0 +1,57 @@
|
||||
// Package debug provides general debug feature management for Gio, including
|
||||
// the ability to toggle debug features using the GIODEBUG environment variable.
|
||||
package debug
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const (
|
||||
debugVariable = "GIODEBUG"
|
||||
textSubsystem = "text"
|
||||
silentFeature = "silent"
|
||||
)
|
||||
|
||||
// Text controls whether the text subsystem has debug logging enabled.
|
||||
var Text atomic.Bool
|
||||
|
||||
var parseOnce sync.Once
|
||||
|
||||
// Parse processes the current value of GIODEBUG. If it is unset, it does nothing.
|
||||
// Otherwise it process its value, printing usage info the stderr if the value is
|
||||
// not understood. Parse will be automatically invoked when the first application
|
||||
// window is created, allowing applications to manipulate GIODEBUG programmatically
|
||||
// before it is parsed.
|
||||
func Parse() {
|
||||
parseOnce.Do(func() {
|
||||
val, ok := os.LookupEnv(debugVariable)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
print := false
|
||||
silent := false
|
||||
for part := range strings.SplitSeq(val, ",") {
|
||||
switch part {
|
||||
case textSubsystem:
|
||||
Text.Store(true)
|
||||
case silentFeature:
|
||||
silent = true
|
||||
default:
|
||||
print = true
|
||||
}
|
||||
}
|
||||
if print && !silent {
|
||||
fmt.Fprintf(os.Stderr,
|
||||
`Usage of %s:
|
||||
A comma-delimited list of debug subsystems to enable. Currently recognized systems:
|
||||
|
||||
- %s: text debug info including system font resolution
|
||||
- %s: silence this usage message even if GIODEBUG contains invalid content
|
||||
`, debugVariable, textSubsystem, silentFeature)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user