README.md: make example better
This commit is contained in:
parent
a924a2250d
commit
12ff68a6f4
@ -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() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user