github.com/akutz/golf

A golang package for listing fields.


License
Apache-2.0
Install
go get github.com/akutz/golf

Documentation

Golf Build Status Coverage Status GoDoc

Go List Fields (Golf) is a package for the Go language that makes it incredibly simple to get a list of fields from any type using the Field Output through Reflective Evaluation function, otherwise known as Fore:

type Person struct {
    Name string
}

p := &Person{"Batman"}

fields := golf.Fore("hero", p)

for k,v := range fields {
    fmt.Printf("%s=%v\n", k,v)
}

The above example will emit the following:

hero.Name=Batman

A simple example, the true power of Golf is in its configuration options.