Skip to content

Instantly share code, notes, and snippets.

@seyedmmousavi
Last active March 30, 2020 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seyedmmousavi/ddcaed71abc1d519ad8f15f48872d9bd to your computer and use it in GitHub Desktop.
Save seyedmmousavi/ddcaed71abc1d519ad8f15f48872d9bd to your computer and use it in GitHub Desktop.
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