Registry / utility / mitchellh-reflectwalk

mitchellh-reflectwalk

JSON →
library1.0.2gogounverified

reflectwalk is a package that allows you to 'walk' complex structures similar to how you may 'walk' a filesystem: visiting every element one by one and calling callback functions allowing you to handle and manipulate those elements.

go get github.com/mitchellh/reflectwalk
INSTALL
IMPORT
SIG · MITCHELLH-REFLECTW
M
mitchellh-reflectwalk
utilitygov1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

reflectwalk
github.com/mitchellh/reflectwalk

Walk through a map and print each value

package main import ( "fmt" "github.com/mitchellh/reflectwalk" ) func main() { data := map[string]interface{}{"a": 1, "b": "hello"} err := reflectwalk.Walk(data, func(v reflect.Value) error { fmt.Println(v.Interface()) return nil }) if err != nil { panic(err) } }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.0.2latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
36
Resources
mitchellh-reflectwalk — go get mitchellh-reflectwalk · libregistry