README.md: make example better

This commit is contained in:
Fatih Arslan 2016-02-24 10:23:52 +02:00
parent a924a2250d
commit 12ff68a6f4

View File

@ -141,10 +141,9 @@ We can also get a slice of Fields from the Struct type to iterate over all
fields. This is handy if you wish to examine all fields: fields. This is handy if you wish to examine all fields:
```go ```go
// Convert the fields of a struct to a []*Field s := structs.New(server)
fields := s.Fields()
for _, f := range fields { for _, f := range s.Fields() {
fmt.Printf("field name: %+v\n", f.Name()) fmt.Printf("field name: %+v\n", f.Name())
if f.IsExported() { if f.IsExported() {