Skip to content

cmd/dist: allow Go to be built inside of module root #44209

Description

@zx2c4

My build system downloads 1.4, downloads newer source, patches it, and then runs ./make.bash. It does this because I have custom patches that require a full rebuild (I can no longer just rebuild cmd/link or similar). I've automated all of this nicely in my makefile, which downloads tarballs, checks hashes, runs build commands, and ultimately .deps/go/bin/go exists and works. The rest of my build system then runs with export PATH := $(CURDIR)/.deps/go/bin:$(PATH). All is well.

Except for one thing: src/cmd/dist/build.go errors out if you're building in a child directory of something with a go.mod in it: fatalf("found go.mod file in %s: $GOROOT must not be inside a module", modRoot). So that means my makefile has to rename go.mod to go.mod.renamed, or struggle to find a good tmp directory on the same partition for atomic moves or some other type of headache.

Instead, it would be nice to be able to run ./make.bash anywhere, regardless of what the parent directories have in them.

Are there any big architectural reasons why this can't be?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions