On Thursday, July 4, 2019 at 2:52:42 AM UTC+2, Ian Lance Taylor wrote:
>
> On Wed, Jul 3, 2019 at 4:39 PM Gert <gert....@gmail.com <javascript:>> 
> wrote: 
> > 
> > On Thursday, July 4, 2019 at 12:39:34 AM UTC+2, Ian Lance Taylor wrote: 
> >> 
> >> On Wed, Jul 3, 2019 at 3:30 PM Gert <gert....@gmail.com> wrote: 
> >> > 
> >> > I changed /usr/local/go/src/builtin/builtin.go 
> >> > 
> >> > type error interface { 
> >> >   Error() string 
> >> >   Unwrap() wrapper.Wrapper 
> >> > } 
> >> > 
> >> > But after compiling go successfully with ./all.bash it seems type 
> error is stil 
> >> > 
> >> > type error interface { 
> >> >   Error() string 
> >> > } 
> >> 
> >> The type "error" is implemented directly in the Go compiler.  The code 
> >> in builtin/builtin.go only exists for documentation purposes.  If you 
> >> want to change error, you'll need to change the compiler. 
> > 
> > 
> > Ok thx trying to dig my way in /usr/local/go/src/go but grepping for 
> error interface doesn't give me a clue where I can find the predefined 
> error interface :( do you perhaps have a path of a filename for me please 
> where it get defined? 
>
> It's created by makeErrorInterface in 
> cmd/compile/internal/gc/universe.go.  But I have no idea what the 
> consequences of changing that function would be.  I would not be 
> surprised if other code in the compiler implicitly assumes the current 
> definition. 
>
> Ian 
>

Thanks before I going to shoot myself in the foot let start by making a new 
build in wrapper interface first in that file

func makeWrapperInterface() *types.Type {
field := types.NewField()
field.Type = types.Types[TSTRING]
f := functypefield(fakeRecvField(), nil, []*types.Field{field})

field = types.NewField()
field.Sym = lookup("Wrapper")
field.Type = f

t := types.New(TINTER)
t.SetInterface([]*types.Field{field})
return t
} 

So basically this should generate a new build in

type wrapper interface {
Unwrap() wrapper
}

Because referencing to a wrapper.Wrapper pretty sure that's already out of 
the question :)
The lookup function gives me a hint that there might be some definition 
files that describe the interface in plain text? If true do you know where 
I can find does files specifically the error interface definition file? 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c57c0bb2-cb52-47ec-9293-63f35e34f3e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to