cmd/go/internal/modfetch: push codehost.Repo locking down one level

The modfetch.Repo needs to be safe for use by multiple goroutines,
but the codehost.Repo (a source code repository) was not,
so we added locking around the codehost.Repo methods.
But we might reasonably have multiple modfetch.Repos (modules)
drawing from a single codehost.Repo, especially if we cache
codehost.Repo construction. So push the locking further down.

After this CL, it would still be nice to add locking in package
codehost on a per-directory basis, so that codehost.Run calls
on a given directory are, or at least can be, serialized,
even when they are being invoked from different processes.
To do that we need to work out the right file locking on each
system, which we'll put off for now. (TODO added.)

(Git is already doing file locking to make access from multiple
processes safe at the level of individual commands.)

Change-Id: I9ce4ecf8f8b49cabea50b8663e3cee60ff95e7c9
Reviewed-on: https://go-review.googlesource.com/119775
Reviewed-by: Bryan C. Mills <bcmills@google.com>
3 files changed
tree: 14b40063f28acc1d9c8646c51dbdebebec511314
  1. vendor/
  2. AUTHORS
  3. codereview.cfg
  4. CONTRIBUTING.md
  5. CONTRIBUTORS
  6. LICENSE
  7. main.go
  8. PATENTS
  9. README.md
README.md

Versioned Go Prototype (vgo)

This repository holds a prototype of what the go command might look like with integrated support for package versioning.

See research.swtch.com/vgo for documents about the design.

Download/Install

Use go get -u golang.org/x/vgo.

You can also manually git clone the repository to $GOPATH/src/golang.org/x/vgo.

Report Issues / Send Patches

See CONTRIBUTING.md.

This is still a very early prototype. You are likely to run into bugs. Please file bugs in the main Go issue tracker, golang.org/issue, and put the prefix x/vgo: in the issue title.

Thank you.