go1.2 breaks http error wrappers
wadey opened this issue · comments
After testing with go1.2, I found that my tigertonic applications don't compile with the following error:
myfile.go:20: implicit assignment of unexported field 'error' in tigertonic.NotFound literal
The code I am doing on this line is basically:
err := &tigertonic.NotFound{fmt.Errorf("My error message")}
Looks like go1.2 is preventing assignment to embedded "error" fields if you aren't in the same package. This seems like a pretty unfortunate change, we might need to make a helper method to construct these wrapper errors.
A fix that I tried that seems to work is to define this type:
type Err error
And then embed this type in the structs instead of error
. Not sure if there are any side effects, but it seems to compile fine this way. I can send a pull request if this sounds like a reasonable solution.
Fixed in #48.