I have to write a program that should verify the content of configuration-servers. It will need a lot of pre-initialized data to verify the actual content of a server, so it has to initialize many strings. What i know from other C-style languages is, that code like
var MyString *string = 'Hello World!'; Will result in having two identical copies of the string »Hello World!« in the memory: The first one within the program-code itself and a second copy somewhere in the heap-memory. How will the go-compiler handle something like this: package main import ("fmt") type MyStruct struct { Text string Count int32 } func main() { MyVar := MyStruct{Text: "Hello World!", Count: 20 } fmt.Printf("%#v\n",MyVar) } Will there be two copies of the string »Hello World!" in the memory or just one? As said, mMy code will contain a gazillion of pre-defined string variables and having each string allocate two copies of itself in memory would be bad for small systems. Thank you very much in advance for your help. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20c9e775-fee8-4ac4-90e7-032ce37909e9n%40googlegroups.com.