Format
specifier ‘%+v’ is used to print the structure with field names.
Example
fmt.Printf("%+v\n",
emp)
App.go
package main import "fmt" type Employee struct { FirstName string LastName string id int } func main() { emp := Employee{"Krishna", "Gurram", 123} fmt.Printf("%+v\n", emp) }
Output
{FirstName:Krishna
LastName:Gurram id:123}
No comments:
Post a Comment