On 28 July 2016 at 10:33, John Meinel <[email protected]> wrote: > ... >> >> >> FWIW there is a proposal for strict field checking in the Go >> encoding/json package (https://github.com/golang/go/issues/15314) >> which would fix the specific issue raised at the start of this thread. >> It's trivial to add that feature (4 lines of code) and pending Go 1.8, >> we could potentially use a forked version of encoding/json for >> unmarshaling API calls to gain it - a quick win for marginal effort. >> That would be more-or-less equivalent to Tim's proposal, I think, but >> without the performance hit. >> >> cheers, >> rog. > > > > I had not found that one in my searching. But from what I could see there > were many proposals over time: > https://github.com/golang/go/issues/10140 > > So I'm not very confident that we'll be able to depend on it, in any > reasonable timeframe. (I actually wondered about UnmarshalStrict() rather > than using Decoder, but we could work around the short cut of > json.Unmarshal)
On the plus side, the issues have not been closed, which means that they will probably accept a PR. When development re-opens for Go 1.8, I'll propose a change upstream. -- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
