commit | 66bf157bf5bcd4cf5e82f17680e12c7fc873a2c1 | [log] [tgz] |
---|---|---|
author | Jay Conrod <jayconrod@google.com> | Wed Feb 24 17:55:24 2021 -0500 |
committer | Jay Conrod <jayconrod@google.com> | Thu Feb 25 16:03:41 2021 +0000 |
tree | f2fd3c0e9d531b8075320fcfa5fb0a803c3e1c08 | |
parent | 66f6d92cabd5a5fdaab68597822ee54e419b37f9 [diff] |
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#44494 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>
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.