Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Print Struct with field names in Golang?

To print a vriable of struct, just use Printf as follow

fmt.Printf(">RESULT: %+v \n", ticket)

This prints following output:

>RESULT: {Id:987654345 Title:ASEMAN Date:0 PlaceId:123 OwnerId:12345412312 IsActivated:true IsDeleted:false EditorId:0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment