-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: strip trailing slash from versioned arguments
'go get' accepts arguments of the form path@version, and it passes them through search.CleanPatterns before querying proxies. With this change, CleanPatterns preserves text after '@' and will strip trailing slashes from the patn. Previously, we did not strip trailing slashes when a version was present, which caused proxy base URL validation to fail. Module paths that end with ".go" (for example, github.com/nats-io/nats.go) use trailing slashes to prevent 'go build' and other commands from interpreting packages as source file names, so this caused unnecessary problems for them. Updates #32483 Change-Id: Id3730c52089e52f1cac446617c20132a3021a808 Reviewed-on: https://go-review.googlesource.com/c/go/+/194600 Run-TryBot: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
- Loading branch information
Jay Conrod
committed
Sep 11, 2019
1 parent
04867cd
commit 8875fb9
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This module's path ends with ".go". | ||
Based on github.com/nats-io/nats.go. | ||
Used in regression tests for golang.org/issue/32483. | ||
|
||
-- .mod -- | ||
module example.com/dotgo.go | ||
|
||
go 1.13 | ||
-- .info -- | ||
{"Version":"v1.0.0"} | ||
-- go.mod -- | ||
module example.com/dotgo.go | ||
|
||
go 1.13 | ||
-- dotgo.go -- | ||
package dotgo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# go list should fail to load a package ending with ".go" since that denotes | ||
# a source file. However, ".go/" should work. | ||
# TODO(golang.org/issue/32483): perhaps we should treat non-existent paths | ||
# with .go suffixes as package paths instead. | ||
! go list example.com/dotgo.go | ||
go list example.com/dotgo.go/ | ||
stdout ^example.com/dotgo.go$ | ||
|
||
# go get -d should succeed in either case, with or without a version. | ||
# Arguments are interpreted as packages or package patterns with versions, | ||
# not source files. | ||
go get -d example.com/dotgo.go | ||
go get -d example.com/dotgo.go/ | ||
go get -d example.com/[email protected] | ||
go get -d example.com/dotgo.go/@v1.0.0 | ||
|
||
# go get (without -d) should also succeed in either case. | ||
# TODO(golang.org/issue/32483): we should be consistent with 'go build', | ||
# 'go list', and other commands. 'go list example.com/dotgo.go' (above) and | ||
# 'go get example.com/dotgo.go' should both succeed or both fail. | ||
[short] skip | ||
go get example.com/dotgo.go | ||
go get example.com/dotgo.go/ | ||
go get example.com/[email protected] | ||
go get example.com/dotgo.go/@v1.0.0 | ||
|
||
-- go.mod -- | ||
module m | ||
|
||
go 1.13 | ||
|
||
require example.com/dotgo.go v1.0.0 |