func (r *whicherrsResult) toSerial(res *serial.Result, fset *token.FileSet) { we := &serial.WhichErrs{} we.ErrPos = fset.Position(r.errpos).String() for _, g := range r.globals { we.Globals = append(we.Globals, fset.Position(g.Pos()).String()) } for _, c := range r.consts { we.Constants = append(we.Constants, fset.Position(c.Pos()).String()) } for _, t := range r.types { var et serial.WhichErrsType et.Type = r.qpos.typeString(t.typ) et.Position = fset.Position(t.obj.Pos()).String() we.Types = append(we.Types, et) } res.WhichErrs = we }