When our go.mod file was introduced in commit
114e85c2002091eb415040923d872f8e4a4bc636 in PR #3208, the module
path chosen did not include a trailing /v2 component. However,
the Go modules specification now advises that module paths must
have a "major version suffix" which matches the release version.
We therefore add a /v2 suffix to our module path and all its
instances in import paths.
See also https://golang.org/ref/mod#major-version-suffixes for
details regarding the Go module system's major version suffix rule.
Right now, all of our locking happens over HTTP. However, in the
future, we'll add support for a pure SSH-based protocol, and we'll want
to use a different concrete implementation, so let's make our lockClient
an interface and switch the concrete implementation to httpLockClient.
Currently the only thing we use in the http.Response object we return
from our locking code is the status code, and in many cases, we don't
even use that. In the future, we'll add support for a pure SSH-based
protocol in the locking client and that code won't generate an HTTP
response, although it will generate an HTTP-equivalent status code, so
updating the API makes it possible for us to abstract the underlying
transport away.
While we're at it, let's rename the variable to "status" in the tests
for ease of reading.
Extract more basic http-related functionality out of lfsapi and
into a new package, lfshttp. Everything is currently functional
aside from authorization.