named type
tags: learning go programming
content
- in Golang Interfaces explained – Alex Edwards, im seeing this:
type Count int- getting very confused because i completely forgot that this is just a named type
- it’s not a struct
- methods can be added to a named type, just like with struct
type Count int
func (c Count) String() string {
return strconv.Itoa(int(c))
}Note
it’s not a single field struct
- this is a single field struct:
type Count struct {
Value int,
}