In Go I get that there are default values for types. Take int in this case which is initialised as a 0.
I have an issue where for me a 0 in an int can be a valid value so I need to check if it's been set by me or initialised as such. Is there any way to tell the difference between them at all?
Considering the following code... I need to be able to tell the difference between testIntOne
and testIntTwo
but they look the same!
package main
import "log"
type test struct {
testIntOne int
testIntTwo int
}
func main() {
s := test{testIntOne: 0}
log.Println(s)
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…