https://codereview.appspot.com/6198055/diff/5001/state/topology.go#newcode545
state/topology.go:545: return "", nil
If the developer asks for a RelationKey, and it doesn't exist, an error
should be returned. Silently returning nothing and hoping that the
developer remembers to check for the case where it doesn't exist every
time is extremely error prone.
Imagine if you had to do this:
f, err := os.Open(filename)
if err != nil {
...
}
if f != nil {
...
}
...
https:/ /codereview. appspot. com/6198055/ diff/5001/ state/topology. go
File state/topology.go (right):
https:/ /codereview. appspot. com/6198055/ diff/5001/ state/topology. go#newcode545 go:545: return "", nil
state/topology.
If the developer asks for a RelationKey, and it doesn't exist, an error
should be returned. Silently returning nothing and hoping that the
developer remembers to check for the case where it doesn't exist every
time is extremely error prone.
Imagine if you had to do this:
f, err := os.Open(filename)
if err != nil {
...
}
if f != nil {
...
}
...
Every time!
The documentation should reflect the change too.
https:/ /codereview. appspot. com/6198055/ diff/5001/ state/topology. go#newcode571 go:571: return "", nil
state/topology.
Ditto.
https:/ /codereview. appspot. com/6198055/