It would be easy to implement MarshalText or MarshalJSON in terms of String; there is no need to generate these:
func (x SomeEnum) MarshalText() ([]byte, error) {
return []byte(x.String()), nil
}
func (x SomeEnum) MarshalJSON() ([]byte, error) {
return json.Marshal(x.String())
}
Note that json.Marshal will use MarshalText if it exists, even though this fact is not documented in the encoding/json package.
Based on the map you listed though, it sounds like you want to do the reverse, and Unmarshal string values into your enum. The stringer command won't do that directly. If all your values are unique and consecutive, you could do this:
var SomeEnumMap = func() map[string]SomeEnum {
out := make(map[string]SomeEnum)
for i := Value1; i <= LastValue, i++ {
out[i.String()] = i
}
return out
}()
Otherwise an "unstringer" tool would be helpful, but as far as I know it doesn't exist.