Skip to content

cmd/go: go install: don’t fail when go.mod can’t be updated on a read-only system #33326

Closed
@stapelberg

Description

@stapelberg
$ go version
go version go1.13beta1 linux/amd64

I talked about this issue with @bcmills over GopherCon 2019 and he recommended I file this issue for tracking.

I am using cmd/go in a build environment where the entire system is read-only, but I have a writable copy of the source tree I’m building (e.g. github.com/junegunn/fzf). The system provides a read-only module cache (at /ro/gopath/pkg/mod) which contains all the dependencies of the source tree.

I’m using replace directives to enforce that my environment’s module versions are used, which can be different from the versions listed in go.mod/go.sum. See #29410 (comment) for details.

When running go install, it fails to lock the module cache because it’s read-only:

go: failed to lock file at /ro/gopath/pkg/mod/cache/lock

So far so good—it’s reasonable to not continuing when the side lock can’t be acquired. But, when specifying -mod=readonly, I’m getting:

go: updates to go.mod needed, disabled by -mod=readonly

I don’t know that go install should error out here. Certainly it could just continue with whatever changes needed just being retained in memory? As a user, I’m interested in the binary installation, not the side effect updates.

Thanks for considering,

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions