Skip to content

gc: interfaces declared inside function bodies are wrong #1290

@rsc

Description

@rsc
this works


       var f interface {
               ImportedLibraries() ([]string, os.Error)
               ImportedSymbols() ([]string, os.Error)
       }
       var err1, err2 os.Error
       if f, err1 = elf.Open(obj); err1 != nil {
               if f, err2 = macho.Open(obj); err2 != nil {
                       fatal("cannot parse %s as ELF (%v) or Mach-O (%v)", obj, err1, err2)
               }
       }

       var err os.Error
       syms, err = f.ImportedSymbols()
       if err != nil {
               fatal("cannot load dynamic symbols: %v", err)
       }

       imports, err = f.ImportedLibraries()
       if err != nil {
               fatal("cannot load dynamic imports: %v", err)
       }

       return


but swapping the two methods in the interface definition
makes each of the calls call the wrong method.

probably something about interface types inside function bodies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions