summaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modfetch/codehost/git_test.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/go/internal/modfetch/codehost: skip tests that fail due to tag mismatchesBryan C. Mills2023-05-051-0/+6
| | | | | | | | | | | For #56881. Change-Id: If9d8fa2942e4dd8da5e673631cdc277e0fe6c962 Reviewed-on: https://go-review.googlesource.com/c/go/+/492975 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
* cmd/go/internal/modfetch/codehost: initialize localGitURL lazily and clean ↵Bryan C. Mills2023-05-041-45/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | up skips Previously localGitURL was initialized in TestMain, which creates needless work if the test flags do not result in running a test that requires localGitURL. We had also been skipping a bunch of tests that used vcs-test.golang.org in order to avoid network traffic, but now that that content is served through an in-process vcweb server that is no longer necessary. (All of the 'git' tests together take less than a second to run.) The 'hg' tests are much slower, so we do still skip those in short mode. Updates #59940. Change-Id: Ie4f2d2bc825d7a011e25e754edf1a7c3c6010c77 Reviewed-on: https://go-review.googlesource.com/c/go/+/491659 Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
* cmd/go: redirect vcs-test.golang.org repo URLs to a test-local serverBryan C. Mills2022-10-251-378/+432
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new server reconstructs the vcs-test repos on the fly using scripts that run the actual version-control binaries. This allows those repos to be code-reviewed using our normal tools — and, crucially, allows contributors to add new vcs-test contents as part of a contributed CL. It also prevents failures due to network errors reaching vcs-test.golang.org (such as when developing offline), and allows us to iterate on the repo contents without dealing with annoying and unpredictable GCS caching behavior. We can't quite turn down vcs-test.golang.org yet — this server doesn't yet handle "go-import" metadata (and related authentication behaviors), and doesn't serve Subversion repos. But we're getting much closer! For #27494. Change-Id: I233fc718617aed287b0f7248bd8cfe1e5cebe96b Reviewed-on: https://go-review.googlesource.com/c/go/+/421455 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
* cmd/go: record origin metadata during module downloadRuss Cox2022-07-051-22/+65
| | | | | | | | | | | | | | | | | | | | | | | | This change adds an "Origin" JSON key to the output of go list -json -m and go mod download -json. The associated value is a JSON object with metadata about the source control system. For Git, that metadata is sufficient to evaluate whether the remote server has changed in any interesting way that might invalidate the cached data. In most cases, it will not have, and a fetch could then avoid downloading a full repo from the server. This origin metadata is also now recorded in the .info file for a given module@version, for informational and debugging purposes. This change only adds the metadata. It does not use it to optimize away unnecessary git fetch operations. (That's the next change.) For #53644. Change-Id: I4a1712a2386d1d8ab4e02ffdf0f72ba75d556115 Reviewed-on: https://go-review.googlesource.com/c/go/+/411397 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
* cmd/go/internal/modfetch/codehost: skip hg tests if no hg binary is presentBryan C. Mills2021-07-071-26/+23
| | | | | | | | | Change-Id: I5cf57bf1153eb662bcab71e3d2c04848212559a6 Reviewed-on: https://go-review.googlesource.com/c/go/+/330989 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
* all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox2020-12-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: update references to symbols moved from io/ioutil to ioRuss Cox2020-10-201-1/+2
| | | | | | | | | | | | | | | | | | | The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
* all: update references to symbols moved from os to io/fsRuss Cox2020-10-201-1/+2
| | | | | | | | | | | | | | | | | | The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
* cmd/go: allow configuring module cache directory with GOMODCACHEMichael Matloob2020-04-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a GOMODCACHE environment variable that's used by cmd/go to determine the location of the module cache. The default value of GOMODCACHE will be GOPATH[0]/pkg/mod, the default location of the module cache before this change. Replace the cmd/go/internal/modfetch.PkgMod variable which previously held the location of the module cache with the new cmd/go/internal/cfg.GOMODCACHE variable, for consistency with many of the other environment variables that affect the behavior of cmd/go. (Most of the changes in this CL are due to moving/renaming the variable.) The value of cfg.GOMODCACHE is now set using a variable initializer. It was previously set in cmd/go/internal/modload.Init. The location of GOPATH/pkg/sumdb is unchanged by this CL. While it was previously determined using the value of PkgMod, it now is determined independently dirctly from the value of GOPATH[0]. Fixes #34527 Change-Id: Id4d31d217b3507d6057c8ef7c52af1a0606603e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/219538 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
* cmd/go: fix windows test failuresJay Conrod2019-11-111-1/+10
| | | | | | | | | | | | | | | | | | search.CleanPatterns now preserves backslash separators in absolute paths in Windows. These had resulted in inconsistent error messages. search.MatchPackagesInFS is now more accepting of patterns with backslashes. It was inconsistent before. Several tests are fixed to work with Windows (mostly to match slashes or backslashes). Fixes #25300 Change-Id: Ibbf9ccd145353f7e3d345205c6fcc01d7066d1c2 Reviewed-on: https://go-review.googlesource.com/c/go/+/206144 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* cmd/go/internal/modfetch/codehost: remove invariantly-empty return value ↵Bryan C. Mills2019-10-241-10/+6
| | | | | | | | | | | | | | | from Repo.ReadZip Previously, codehost.Repo.ReadZip returned an 'actualSubdir' value that was the empty string in all current implementations. Updates #26092 Change-Id: I6708dd0f13ba88bcf1a1fb405e9d818fd6f9197e Reviewed-on: https://go-review.googlesource.com/c/go/+/203277 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
* cmd/go: call flag.Parse to properly initialize test environment variablesJakub Čajka2018-07-131-0/+4
| | | | | | | | | | | | | | | | | | Executing tests in src/cmd/go/internal/modfetch/codehost/git_test.go in enviroment witout outside connectivity in to the internet results in tests failure: 2018/07/13 14:31:14 git clone --mirror https://vcs-test.golang.org/git/gitrepo1 /tmp/gitrepo-test-996701800/gitrepo2 in : exit status 128: Cloning into bare repository '/tmp/gitrepo-test-996701800/gitrepo2'... fatal: unable to access 'https://vcs-test.golang.org/git/gitrepo1/': Could not resolve host: vcs-test.golang.org FAIL cmd/go/internal/modfetch/codehost 0.307s Fixes #26007 Change-Id: Ia39d8b3215c920dad6c0c58ffabb0b2ab39bb55c Reviewed-on: https://go-review.googlesource.com/123735 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/go: merge module support from x/vgo repoRuss Cox2018-07-121-0/+631
This CL corresponds to CL 123361, the final manual CL in that repo, making this the final manual sync. All future commits will happen in this repo (the main Go repo), and we'll update x/vgo automatically with a fixed patch+script. Change-Id: I572243309c1809727604fd704705a23c30e85d1a Reviewed-on: https://go-review.googlesource.com/123576 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>