Docs · Issues · Releases · 中文文档
Goal Supports provides common building blocks for Goal projects: type-safe field access (BaseFields), logging wrappers, command signature parsing, utilities, exceptions and signal providers.
- BaseFields: typed getters and optional defaults with provider pattern
- Logging: structured logging with debug switch
- Commands: DSL signature parsing, argument injection
- Utils: conversions, reflection, files, random, maps, fields flattening
- Exceptions/Signal: helpers and service providers
- Go
>= 1.25.0 - Module path:
github.com/goal-web/supports
package main
import (
"github.com/goal-web/supports"
"github.com/goal-web/supports/logs"
"github.com/goal-web/supports/utils"
)
type provider struct{ supports.BaseFields }
func main() {
p := &provider{}
p.OptionalGetter = func(key string, defaultValue any) any { return defaultValue }
v := p.StringOptional("app.name", "goal")
logs.Default().WithField("name", v).Info("ready")
f := utils.ToFields(map[string]any{"a": map[string]any{"b": 1}})
utils.Flatten(make(map[string]any), f, ".")
}sig := "demo {name} {count?} {--force} {--driver=aes}"
name, args := supports_commands.ParseSignature(sig)
_ = name
_ = args- Keep API backward compatible, update docs/examples for changes
- Build and run tests before submitting
- Use Issues/Discussions for proposals
- More tests for commands/exceptions/signal
- Example app and smoke tests
- English/Chinese docs maintained
- See Releases: https://github.com/goal-web/supports/releases
- Do not commit secrets; prefer env vars or encrypted configs
- Use typed getters to avoid implicit conversions
- Prefer local builds of tools aligned with target Go version