I defined an enumeration and struct type like so:
type NodeType int
const (
City NodeType = iota
Town
Village
)
type AreaNode struct {
Location Coord2D
Type NodeType
}
and now I'm iterating over a series of nodes that each have a type
if node, ok := area.Nodes[coord]; ok {
switch node.Type {
case node.Type == City:
// do something for City
case node.Type == Town:
// do something for Town
case node.Type == Outpost:
// do something for Outpost
}
}
However I'm getting an error: incompatible types in binary expression.
How can I resolve this?