Skip to content

x/tools/go/loader: when loading >1 initial package in ImportBinary mode, some dependencies are loaded twice #9955

@rsc

Description

@rsc

This is breaking a code cleanup tool I am building.

g% cat /tmp/x.go
package main

import (
    "fmt"
    "log"

    "golang.org/x/tools/go/loader"
)

func main() {
    var conf loader.Config
    _, err := conf.FromArgs([]string{"cmd/nm", "cmd/pprof", "debug/gosym"}, false)
    if err != nil {
        log.Fatal(err)
    }
    _, err = conf.Load()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("OK\n")
}

g% go run /tmp/x.go
/Users/rsc/g/go/src/cmd/pprof/pprof.go:196:12: cannot assign pcln (variable of type *debug/gosym.Table) to f.pcln (variable of type *debug/gosym.Table)
2015/02/21 13:25:20 couldn't load packages due to errors: cmd/pprof
exit status 1
g%

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions