bp, err := ctxt.ImportDir(dir, 0)
pkg := new(Package)
+ pkg.local = true
pkg.load(&stk, bp, err)
pkg.localPrefix = dirToImportPath(dir)
pkg.ImportPath = "command-line-arguments"
func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action, mainpkg string, ofiles []string) error {
importArgs := b.includeArgs("-L", allactions)
- return b.run(p.Dir, p.ImportPath, tool(archChar+"l"), "-o", out, importArgs, buildLdflags, mainpkg)
+ return b.run(".", p.ImportPath, tool(archChar+"l"), "-o", out, importArgs, buildLdflags, mainpkg)
}
func (gcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
ldflags = append(ldflags, afile)
}
ldflags = append(ldflags, cgoldflags...)
- return b.run(p.Dir, p.ImportPath, "gccgo", "-o", out, buildGccgoflags, ofiles, "-Wl,-(", ldflags, "-Wl,-)")
+ return b.run(".", p.ImportPath, "gccgo", "-o", out, buildGccgoflags, ofiles, "-Wl,-(", ldflags, "-Wl,-)")
}
func (gccgcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
// gccCmd returns a gcc command line prefix
func (b *builder) gccCmd(objdir string) []string {
+ // NOTE: env.go's mkEnv knows that the first three
+ // strings returned are "gcc", "-I", objdir (and cuts them off).
+
// TODO: HOST_CC?
a := []string{"gcc", "-I", objdir, "-g", "-O2"}
p.copyBuild(bp)
// The localPrefix is the path we interpret ./ imports relative to.
- // Now that we've fixed the import path, it's just the import path.
// Synthesized main packages sometimes override this.
- p.localPrefix = p.ImportPath
+ p.localPrefix = dirToImportPath(p.Dir)
if err != nil {
p.Incomplete = true
}
p1 := loadImport(path, p.Dir, stk, p.build.ImportPos[path])
if p1.local {
+ if !p.local && p.Error == nil {
+ p.Error = &PackageError{
+ ImportStack: stk.copy(),
+ Err: fmt.Sprintf("local import %q in non-local package", path),
+ }
+ pos := p.build.ImportPos[path]
+ if len(pos) > 0 {
+ p.Error.Pos = pos[0].String()
+ }
+ }
path = p1.ImportPath
importPaths[i] = path
}