commit | 2823f815b3c909fe0ef26d6e1b6145cf200ae16e | [log] [tgz] |
---|---|---|
author | Jay Conrod <jayconrod@google.com> | Wed Feb 24 17:55:24 2021 -0500 |
committer | Dmitri Shuralyov <dmitshur@golang.org> | Tue Mar 02 22:50:16 2021 +0000 |
tree | f2fd3c0e9d531b8075320fcfa5fb0a803c3e1c08 | |
parent | b038bf73c0076991a53e5f6dbf449815464cb356 [diff] |
[internal-branch.go1.16-vendor] modfile: defer fixing versions in retract directives VersionFixers require both a path and a version: if the version is non-canonical (like a branch name), they generally need the path to look up the proper version. This is fine for require, replace, and exclude directives, since the path is specified with each version. For retract directives, the path comes from the module directive, which may appear later in the file. Previously, we just used the empty string, but this breaks reasonable implementations. With this change, we leave retracted versions alone until the file has been completely parsed, then we apply the version fixer to each retract directive. We report an error if retract is used without a module directive. For golang/go#44496 Change-Id: I99b7b8b55941c1fde4ee56161acfe854bcaf948d Reviewed-on: https://go-review.googlesource.com/c/mod/+/296130 Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit 66bf157bf5bcd4cf5e82f17680e12c7fc873a2c1) Reviewed-on: https://go-review.googlesource.com/c/mod/+/298010 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This repository holds packages for writing tools that work directly with Go module mechanics. That is, it is for direct manipulation of Go modules themselves.
It is NOT about supporting general development tools that need to do things like load packages in module mode. That use case, where modules are incidental rather than the focus, should remain in x/tools, specifically x/tools/go/packages.
The specific case of loading packages should still be done by invoking the go command, which remains the single point of truth for package loading algorithms.