feat(go-config): multi-format codecs, envc CLI, fixtures, ASRs
- Module github.com/eslider/go-config with env/yaml/json/ini packages - internal: source, keymap, merge, structconv, bytesutil - cmd/envc: convert, get, merge - docs/asr ASR-0001..0008, README/CHANGELOG/AGENTS refresh - golangci-lint v2 config; tests + fixtures Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package config_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/eslider/go-config/env"
|
||||
"github.com/eslider/go-config/yaml"
|
||||
)
|
||||
|
||||
func Example_hero_offline() {
|
||||
// README hero pattern using offline sources (no network, no .env files).
|
||||
y := yaml.New(yaml.WithBytes([]byte(`service: { name: demo }`)))
|
||||
e := env.New(env.WithBytes([]byte("SERVICE_PORT=8080")))
|
||||
var m map[string]any
|
||||
_ = y.Unmarshal(&m)
|
||||
var flat map[string]any
|
||||
_ = e.Unmarshal(&flat)
|
||||
fmt.Println(m["service"].(map[string]any)["name"], flat["service"].(map[string]any)["port"])
|
||||
// Output: demo 8080
|
||||
}
|
||||
Reference in New Issue
Block a user