• Bryan C. Mills's avatar
    cmd/go: enable module mode without a main module when GO111MODULE=on · cdbd4d49
    Bryan C. Mills authored
    This is as minimal a change as I could comfortably make to enable 'go
    get' outside of a module for 1.12.
    
    In general, commands invoked in module mode while outside of a module
    operate as though they are in a module with an initially-empty go.mod
    file. ('go env GOMOD' reports os.DevNull.)
    
    Commands that operate on the current directory (such as 'go list' and
    'go get -u' without arguments) fail: without a module definition, we
    don't know the package path. Likewise, commands whose sole purpose is
    to write files within the main module (such as 'go mod edit' and 'go
    mod vendor') fail, since we don't know where to write their output.
    
    Since the go.sum file for the main module is authoritative, we do not
    check go.sum files when operating outside of a module. I plan to
    revisit that when the tree opens for 1.13.
    
    We may also want to revisit the behavior of 'go list': it would be
    useful to be able to query individual packages (and dependencies of
    those packages) within versioned modules, but today we only allow
    versioned paths in conjunction with the '-m' flag.
    
    Fixes #24250
    
    RELNOTE=yes
    
    Change-Id: I028c323ddea27693a92ad0aa4a6a55d5e3f43f2c
    Reviewed-on: https://go-review.googlesource.com/c/148517
    Run-TryBot: Bryan C. Mills <bcmills@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    cdbd4d49
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...