Embedding Structs in Go with pointer or with value, what is difference between them?

Gopher

Lets go!!

Published · Feb 6

I can embed in golang with pointer and value. By pointer
type Bitmap struct{ data [4][4]bool } type Renderer struct{ *Bitmap on uint8 off uint8 }

By value
type Bitmap struct{ data [4][4]bool } type Renderer struct{ Bitmap on uint8 off uint8 }

What is more prefer by pointer or value?

Write your answer...

Never miss a post from Gopher , when you sign up for Ednsquare.