Skip to content

cmd/go: unable to run go commands from within another GOROOT #30756

@josharian

Description

@josharian

First off: This is a weird issue. I acknowledge that. But it messes with my personal workflow, so I'm curious whether it can be satisfactorily resolved.

Reproduce:

  • Clone toolchain to .../a; run .../a/make.bash
  • Ditto in .../b
  • cd .../b/src
  • Execute .../a/bin/go test bytes

Result:

go: reserved module path std not allow outside of GOROOT/src

There are three things going on here:

  • Grammatical error in error message.
  • Mysterious error message; it took me a while to realize the problem.
  • I don't see why this no longer works. Why must this be an error?

For context: When working on the compiler, I generally hang out in GOROOT/src. I use compilecmp to generate built toolchains with different versions. Then I refer to those versions by absolute path to run benchmarks.

This also sometimes happens under the hood. I already had to fix compilecmp because it could not be run from GOROOT/src because of the same issue.

It's an annoyance to have to cd around to run benchmarks, take care with what dir you're piping results to, etc.

cc @bcmills @jayconrod

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions