func (pm *PodManifest) UnmarshalJSON(data []byte) error { p := podManifest(*pm) err := json.Unmarshal(data, &p) if err != nil { if serr, ok := err.(*json.SyntaxError); ok { line, col, highlight := errorutil.HighlightBytePosition(bytes.NewReader(data), serr.Offset) return fmt.Errorf("\nError at line %d, column %d\n%s%v", line, col, highlight, err) } return err } npm := PodManifest(p) if err := npm.assertValid(); err != nil { return err } *pm = npm return nil }
func (im *ImageManifest) UnmarshalJSON(data []byte) error { a := imageManifest(*im) err := json.Unmarshal(data, &a) if err != nil { if serr, ok := err.(*json.SyntaxError); ok { line, col, highlight := errorutil.HighlightBytePosition(bytes.NewReader(data), serr.Offset) return fmt.Errorf("\nError at line %d, column %d\n%s%v", line, col, highlight, err) } return err } nim := ImageManifest(a) if err := nim.assertValid(); err != nil { return err } *im = nim return nil }