How do I construct a primitive integer type directly on the heap in Go?
For composite literals, the following syntax is supported:
return &File{fd, name, nil, 0}
But no such equivalent seems to exist for int and friends:
Size: &uint64(entry.FileInfo.Size()),
d:\gopath\src\bitbucket.org\anacrolix\dms\dlna\dms\dms.go:271: cannot take the address of uint64(entry.FileInfo.Size())
Primitive integer types are not addressable. If the integer is a register variable, there is no memory address. If the integer is a constant, providing its memory address would allow it to be modified.
Therefore, create an integer type variable and take its address or use an integer pointer type. For example,
Output: