Spot the bug Go
1
// Mark every server healthy after a successful probe.
2
type Server struct {3
Name string
4
Healthy bool
5
}
6
7
func markAllHealthy(servers []Server) {8
for _, srv := range servers {9
srv.Healthy = true
10
}
11
}
12
13
func main() {14
fleet := []Server{{Name: "a"}, {Name: "b"}}15
markAllHealthy(fleet)
16
fmt.Println(fleet[0].Healthy, fleet[1].Healthy) // expected: true true
17
}