19 lines
294 B
Go
19 lines
294 B
Go
package showstruct
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
)
|
|
|
|
func Show(item any) {
|
|
val := reflect.ValueOf(item)
|
|
typ := val.Type()
|
|
|
|
for i := 0; i < val.NumField(); i++ {
|
|
field := val.Field(i)
|
|
fieldType := typ.Field(i)
|
|
|
|
fmt.Printf("Field : %s, Value: %v\n", fieldType.Name, field.Interface())
|
|
}
|
|
}
|