mirror of
https://github.com/golang/go
synced 2024-09-23 17:20:13 -06:00
Error if -insecure is provided to go get
This commit is contained in:
parent
37c56a8b7b
commit
aa018af6f8
@ -98,11 +98,12 @@ Usage: ` + CmdGet.UsageLine + `
|
||||
}
|
||||
|
||||
var (
|
||||
getD = CmdGet.Flag.Bool("d", false, "")
|
||||
getF = CmdGet.Flag.Bool("f", false, "")
|
||||
getT = CmdGet.Flag.Bool("t", false, "")
|
||||
getU = CmdGet.Flag.Bool("u", false, "")
|
||||
getFix = CmdGet.Flag.Bool("fix", false, "")
|
||||
getD = CmdGet.Flag.Bool("d", false, "")
|
||||
getF = CmdGet.Flag.Bool("f", false, "")
|
||||
getT = CmdGet.Flag.Bool("t", false, "")
|
||||
getU = CmdGet.Flag.Bool("u", false, "")
|
||||
getFix = CmdGet.Flag.Bool("fix", false, "")
|
||||
getInsecure = CmdGet.Flag.Bool("insecure", false, "")
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -121,6 +122,9 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
|
||||
if *getF && !*getU {
|
||||
base.Fatalf("go get: cannot use -f flag without -u")
|
||||
}
|
||||
if *getInsecure {
|
||||
base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
|
||||
}
|
||||
|
||||
// Disable any prompting for passwords by Git.
|
||||
// Only has an effect for 2.3.0 or later, but avoiding
|
||||
|
@ -218,12 +218,13 @@ variable for future go command invocations.
|
||||
}
|
||||
|
||||
var (
|
||||
getD = CmdGet.Flag.Bool("d", false, "")
|
||||
getF = CmdGet.Flag.Bool("f", false, "")
|
||||
getFix = CmdGet.Flag.Bool("fix", false, "")
|
||||
getM = CmdGet.Flag.Bool("m", false, "")
|
||||
getT = CmdGet.Flag.Bool("t", false, "")
|
||||
getU upgradeFlag
|
||||
getD = CmdGet.Flag.Bool("d", false, "")
|
||||
getF = CmdGet.Flag.Bool("f", false, "")
|
||||
getFix = CmdGet.Flag.Bool("fix", false, "")
|
||||
getM = CmdGet.Flag.Bool("m", false, "")
|
||||
getT = CmdGet.Flag.Bool("t", false, "")
|
||||
getU upgradeFlag
|
||||
getInsecure = CmdGet.Flag.Bool("insecure", false, "")
|
||||
// -v is cfg.BuildV
|
||||
)
|
||||
|
||||
@ -273,6 +274,9 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
|
||||
if *getM {
|
||||
base.Fatalf("go get: -m flag is no longer supported; consider -d to skip building packages")
|
||||
}
|
||||
if *getInsecure {
|
||||
base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
|
||||
}
|
||||
load.ModResolveTests = *getT
|
||||
|
||||
// Do not allow any updating of go.mod until we've applied
|
||||
|
13
src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt
vendored
Normal file
13
src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# GOPATH: Set up
|
||||
env GO111MODULE=off
|
||||
|
||||
# GOPATH: Fetch with insecure, should error
|
||||
! go get -insecure test
|
||||
stderr 'go get: -insecure flag is no longer supported; use GOINSECURE instead'
|
||||
|
||||
# Modules: Set up
|
||||
env GO111MODULE=on
|
||||
|
||||
# Modules: Fetch with insecure, should error
|
||||
! go get -insecure test
|
||||
stderr 'go get: -insecure flag is no longer supported; use GOINSECURE instead'
|
Loading…
Reference in New Issue
Block a user