For golang/go#48257
Change-Id: I9cbb222c93a066717595bec14ff26f2902ef05d9
Reviewed-on: https://go-review.googlesource.com/c/mod/+/359412
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
x/mod does not seem to be affected by this CVE (which is for
x/crypto/ssh), but let's update anyway.
Fixesgolang/go#48943
Change-Id: I13f957a354d6f0260ae9fd586b6218151182909c
Reviewed-on: https://go-review.googlesource.com/c/mod/+/355630
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>
The err field is assigned in the parse function but never used on another function.
Change-Id: I1ea5fa922776c2c83f5269724f856e8d667f43b4
Reviewed-on: https://go-review.googlesource.com/c/mod/+/353749
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Trailing slash of glob was not accepted in MatchPrefixPattern. This
CL starts to accept the trailing slash.
Change-Id: I25e385ffe3a6901d2f475b86507d3e3091a32183
GitHub-Last-Rev: 5dbe41e545
GitHub-Pull-Request: golang/mod#5
Reviewed-on: https://go-review.googlesource.com/c/mod/+/351319
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
When reading go.mod, SetRequireSeparateIndirect will insert new
requirements into the last uncommented direct-only or indirect-only
block OR line. If the last such statement is a line,
SetRequireSeparateIndirect converts it to a block before inserting new
requirements. Cleanup will convert it back to a line later if no
requirements are inserted.
For golang/go#47733
Change-Id: Id8ee3b0ce2d005488ddb3d9a5349115bd93938e7
Reviewed-on: https://go-review.googlesource.com/c/mod/+/348576
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>
Reviewed-by: Michael Matloob <matloob@golang.org>
SetRequireSeparateIndirect now makes a stronger attempt to keep
automatically added requirements in two blocks: one containing only
direct requirements and one containing only indirect
requirements. SetRequireSeparateIndirect will find or add these two
blocks (commented blocks are left alone). New requirements are added
to one of these two blocks. Existing requirements may be moved between
these two blocks if their markings change.
SetRequireSeparateIndirect attempts to preserve existing structure in
the file by not adding requirements to or moving requirements from
blocks with block-level comments and blocks other than the last
uncommented direct-only and indirect-only block.
As an exception to aid with migration, if the file contains a single
uncommented block of requirements (as would the be the case if the
user started with a 1.16 go.mod file, changed the go directive to
1.17, then ran 'go mod tidy'), SetRequireSeparateIndirect will split
the block into direct-only and indirect-only blocks.
This is a change in behavior, but it has no semantic effect, and it
should result in cleaner, more stable go.mod files.
For golang/go#47563
For golang/go#47733
Change-Id: Ifa20bb084c6bdaf1e00140600380857de8afa320
Reviewed-on: https://go-review.googlesource.com/c/mod/+/343431
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Add ErrUnrecognizedVCS, which allows calling functions (such as gorelease) to
fallback: usually to CreateFromDir.
Updates golang/go#37413
Change-Id: I846f72b1ce22bfc699e8cd83b28ea4529e73d6e9
Reviewed-on: https://go-review.googlesource.com/c/mod/+/345730
Trust: Jean de Klerk <deklerk@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This change adds interfaces to the mod package to support parsing
and representing go.work files, including WorkFile for the file as a
whole, Directory for directory statements, and ParseWork for parsing
go.work files.
This code is mostly a lightly modified version of the parsing
code for mod files.
This is meant to support the workspaces proposal and if the proposal
is accepted it's expected theinterface will likely change.
For #45713
Change-Id: I5df6fe4acba1dbe86bc3e3fba40a04fbb4d678e4
Reviewed-on: https://go-review.googlesource.com/c/mod/+/336089
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
(cherry picked from commit e41a6a4f3b)
Reviewed-on: https://go-review.googlesource.com/c/mod/+/324764
Reviewed-by: Bryan C. Mills <bcmills@google.com>
As suggested by Ian for similar code on CL 326010.
Change-Id: I7c6ca4191481daf253eba5f12e7079f5c3522e88
Reviewed-on: https://go-review.googlesource.com/c/mod/+/327029
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Updates golang/go#37413
Change-Id: I5ea07a6e4eedc6cb215e4893944f1ab215ea8f2b
Reviewed-on: https://go-review.googlesource.com/c/mod/+/330769
Trust: Jean de Klerk <deklerk@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This CL adds a headstone to checkFiles in the form of additional documentation,
which should hopefully help future developers.
Change-Id: I7957766fc78da45007cbb4e7e3ed59ad2bada4c5
Reviewed-on: https://go-review.googlesource.com/c/mod/+/338669
Trust: Jean de Klerk <deklerk@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
The new method is a variant of SetRequire, but adds new indirect
dependencies only in indirect-only blocks, and does not add new direct
dependencies to existing indirect-only blocks.
For golang/go#45965
Change-Id: I6730b586396658e710e4bf2afcf64fb2c827203f
Reviewed-on: https://go-review.googlesource.com/c/mod/+/325971
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
For golang/go#45965
Change-Id: I331d068d115b145239933da0d8341a1627124935
Reviewed-on: https://go-review.googlesource.com/c/mod/+/325970
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
The act of marking a line for removal intentionally does not depend on
the rest of the syntax tree, in order to avoid quadratic behavior.
Make that property more explicit by defining it as a method on Line
rather than FileSyntax.
For golang/go#45965
Change-Id: I475625eddf57396411a3fb73eaedd624dd7af3d6
Reviewed-on: https://go-review.googlesource.com/c/mod/+/325969
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
I started this change by expanding the documentation and tests for
SetRequire. Unfortunately, the tests failed when the existing
contents included duplicates of a module path:
--- FAIL: TestSetRequire/existing_duplicate (0.00s)
rule_test.go:1011: after Cleanup, len(Require) = 3; want 1
--- FAIL: TestSetRequire/existing_duplicate_multi (0.00s)
rule_test.go:1011: after Cleanup, len(Require) = 3; want 1
So then I fixed the detected bug, by updating the Line entries
(possibly marking them for removal) in the same loop that updates the
Require entries. (We don't need to loop over f.Syntax.Stmt separately
to remove deleted entries because f.Syntax.Cleanup already does that.)
For golang/go#45965
Change-Id: I1b665c0832112de2c4273628f266dc3d966fefdd
Reviewed-on: https://go-review.googlesource.com/c/mod/+/325230
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
For golang/go#45965
Change-Id: If3c7255f44adc81b69e8109a5d9d62f116579bbd
Reviewed-on: https://go-review.googlesource.com/c/mod/+/323171
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>
I added this test case while updating documentation for
golang/go#45965, and it failed. This CL fixes the behavior,
and the next CL in the stack documents it.
For golang/go#45965
Change-Id: Ia68dbd33530eec138745c6e291b096a9fa1e1d58
Reviewed-on: https://go-review.googlesource.com/c/mod/+/323170
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>
It is unclear what the future holds for the go line in go.mod files.
Perhaps at some point we will switch to semver numbering.
Perhaps at some point we will allow specifying minor versions
or even betas and release candidates.
Those kinds of changes are difficult today because the go line
is parsed in dependency modules, meaning that older
versions of the Go toolchain need to understand newer go lines.
This CL makes that case - parsing a go line in a dependency's
go.mod file - a bit more lax about how to find the version.
It allows a leading v and any trailing non-digit-prefixed string
after the MAJOR.MINOR section.
There are no concrete plans to make use of any of these changes,
but if in the future we want to make them, having a few Go releases
under out belt that will accept the syntax in dependencies will
make any changes significantly easier.
See also CL 317690 in the main repo.
Change-Id: I7c7733c62259b3f25683ed618bc4918c98061396
Reviewed-on: https://go-review.googlesource.com/c/mod/+/317689
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
When there is an // indirect comment next to a dependency that is not actually indirect;
go mod tidy should remove it.
This was not the case when the //indirect comment was badly formatted.
We now check whether such a comment exists irrespective of the formatting.
Updates golang/go#45932
Change-Id: I6a7dca23059a0aca6f8f940da975a0d79f701571
GitHub-Last-Rev: b884ee1a3e
GitHub-Pull-Request: golang/mod#3
Reviewed-on: https://go-review.googlesource.com/c/mod/+/316569
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
For golang/go#45447
Change-Id: I38b13bc912851aa9b6cdeb851330a5ed97b743ac
Reviewed-on: https://go-review.googlesource.com/c/mod/+/316629
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This change was produced using 'go mod tidy -go=1.17'
with a go command built at CL 315210.
This activates lazy loading, and updates the go.mod file to maintain
the lazy-loading invariants (namely, including an explicit requirement
for every package transitively imported by the main module).
Note that this does *not* prevent users with earlier go versions from
successfully building packages from this module.
For golang/go#36460
Change-Id: If672eca0dad61b3f6050a94c758d605b6586cbc3
Reviewed-on: https://go-review.googlesource.com/c/mod/+/316113
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Deprecation notices start with "Deprecated:" at the beginning of a
line and run until the end of the paragraph.
This CL reuses text extraction code for retraction rationale, so the
same rules apply: comment text may be from the comments above a
"module" directive or as a suffix on the same line.
For golang/go#40357
Change-Id: Id5524149c6bbda3effc64c6b668b701b5cf428af
Reviewed-on: https://go-review.googlesource.com/c/mod/+/301089
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>
Reviewed-by: Michael Matloob <matloob@golang.org>
For golang/go#44969
Change-Id: I148a18b676061cd8ea481c3f5130d0792c0b5233
Reviewed-on: https://go-review.googlesource.com/c/mod/+/304151
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>
For golang/go#44969
Change-Id: Ie094d59140764b7f1cffb879d99a13da23a977da
Reviewed-on: https://go-review.googlesource.com/c/mod/+/304150
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>
CheckPath, CheckImportPath, and CheckFilePath now return this error.
To be used in CL 297634.
Change-Id: Ibc4af7c5593f35216ab3ade0b024971061b8cf97
Reviewed-on: https://go-review.googlesource.com/c/mod/+/297891
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>
For golang/go#44776.
Change-Id: I1bc3df2800a1765296c5164aa8bece495d8f9221
Reviewed-on: https://go-review.googlesource.com/c/mod/+/300149
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>
These were always disallowed, but the restriction wasn't enforced in
most cases until Go 1.16. That's broken more projects than we hoped.
This change allows leading dots in import path elements. Leading dots
are still not allowed in module path elements. Leading dots were
always allowed in file path elements. Trailing dots are still
forbidden in all cases.
For golang/go#43985
Change-Id: Id9cf728a341931565ab9e81f600b2341aa178683
Reviewed-on: https://go-review.googlesource.com/c/mod/+/297089
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>
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>
In CL 279394 we started validating that versions in "exclude" and
"retract" directives are canonical. Unfortunately, we use the semver
package's notion of canonicalness, and the semver package doesn't know
anything about +incompatible versions or major-version suffixes.
The resulting error messages also don't indicate an appropriate fix if
the problem is that the user forgot either the "+incompatible" suffix
on the version string or the "/vN" suffix on the module path.
This change corrects both of those problems by validating the version
against the corresponding module path. (For "exclude" directives, that
is the module path to be excluded; for "retract" directives, it is the
module declared in the "module" directive of the same go.mod file.)
For golang/go#44497
Change-Id: I39732d79c3ab3a43bb1fb8905062fe6cb26d3edc
Reviewed-on: https://go-review.googlesource.com/c/mod/+/295089
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Version strings set by -retract and -exclude are not canonicalized
by go mod commands. This change adds validation to go mod edit to
prevent invalid version strings from being added to the go.mod file.
For golang/go#43280
Change-Id: I3708b7a09111a56effac1fe1165122772e3f2d75
Reviewed-on: https://go-review.googlesource.com/c/mod/+/279394
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Michael Matloob <matloob@golang.org>
There are a number of calls to semver.Max in the wild, so let's not
delete it yet.
For golang/go#32700
Change-Id: I515b05f174195d1b82a931b92e21b83c370ef7c7
Reviewed-on: https://go-review.googlesource.com/c/mod/+/269357
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 backports golang.org/cl/154102 to reduce the differences between
the path checking done for import paths by the go command, and
module.CheckImportPath
For golang/go#29230
Change-Id: I1b03de85e560504b5ddb32ebdaf6d7e4384f992c
Reviewed-on: https://go-review.googlesource.com/c/mod/+/250920
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
"+" was allowed in some vcs regular expressions, but doesn't seem
to be used in practice anymore. Stop accepting it in import paths.
This is being submitted early in the Go 1.16 cycle so that if a
usage is detected it can be reverted. See the discussion in
golang.org/issue/31376 for more details.
For golang/go#31376
Change-Id: I392fcdcf829886bd0a28450ba5e399e64dd01559
Reviewed-on: https://go-review.googlesource.com/c/mod/+/250919
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
These functions may be used to check whether the files in an abstract
list, a directory, or a module zip file satisfy the module name and
size constraints listed in the package documentation. Each function
returns a CheckedFiles record that lists valid, omitted, and invalid
files, as well as any size-related error for the whole set of
files. The omitted and invalid lists have an error for each file,
saying why it was omitted or invalid.
Create, CreateFromDir, and Unzip are now implemented using these
functions (or common code). They now return errors based on
CheckedFiles errors. Most error messages won't change, but if multiple
files are invalid, they will be all be listed instead of just the
first one.
Fixesgolang/go#36058
Updates golang/go#39091
Change-Id: I9d4d508288bbd821f93423e712232d8a68356529
Reviewed-on: https://go-review.googlesource.com/c/mod/+/235597
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This CL adds support for parsing and programmatically adding and
removing a new directive, "retract", as described in golang/go#24031.
The "retract" directive comes in two forms:
retract v1.0.0 // single version
retract [v1.1.0, v1.2.0] // closed interval
Updates golang/go#24031
Change-Id: I1236c7d89e7674abf694e49e9b4869b14a59fac0
Reviewed-on: https://go-review.googlesource.com/c/mod/+/228039
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
In v0.2.0, the go.mod lexer removed trailing LF bytes from comment
tokens. This regressed in v0.3.0. Documentation on Comment.Token says
the trailing newline should not be included.
This CL fixes the lexer to strip trailing newlines again. It will now
strip both LF and CRLF newlines. It also includes a test to ensure
comments are attached at the right place in the syntax tree with the
right content.
Fixesgolang/go#39913
Change-Id: I7fba0ed3c85f0a3c23fefc6b7fecfe6df7777aea
Reviewed-on: https://go-review.googlesource.com/c/mod/+/240557
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This CL exposes a new MatchPrefixPatterns function, extracted from
GlobsMatchPath in src/cmd/go/internal/str. Tool authors can use this to
identify non-public modules by matching against GOPRIVATE, as is
explicitly suggested by `go help module-private`.
Fixesgolang/go#38725
Change-Id: I5be79b49c2c13f2d68c7421a06747a297f48f21a
Reviewed-on: https://go-review.googlesource.com/c/mod/+/239797
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
The characters '( ) [ ] { } ,' are now scanned as separate tokens,
even when they are preceded by non-whitespace "identifier"
characters. Previously, '( )' were scanned like this when preceded by
whitespace, but they could be in the middle of an identifier
token. None of these characters are allowed in module paths or
versions. They are allowed within file paths, so file paths containing
them will need to be quoted in the future. Using these characters
should not break ParseLax, since replace directives (the only directive
that allows files paths) are ignored by ParseLax.
Additionally, '(' is only treated as the beginning of a block if it
appears at the end of the line or is immediately followed by ')' at the
end of the line. ')' is treated as the end of a block if it
appears within a block at the beginning of a line.
Fixesgolang/go#38167
Updates golang/go#38144
Updates golang/go#24031
Change-Id: I5a7fb522163802c3723d289cf0fbc5856ca075ec
Reviewed-on: https://go-review.googlesource.com/c/mod/+/226639
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Old versions of modfile before CL 228039 should be able to parse and
ignore retract directives with version intervals.
Updates golang/go#24031
Change-Id: I0f35261997c0704a785ea8467dc5ed0738549966
Reviewed-on: https://go-review.googlesource.com/c/mod/+/230697
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
The underlying package doesn't interact with VCS. The test just does
this to simulate what the go command does. A VCS failure indicates a
problem with the test environment, not with the code being tested.
Fixesgolang/go#38466
Change-Id: I1c36f7c9c644b22e01fa073a5d8a58c9a3893145
Reviewed-on: https://go-review.googlesource.com/c/mod/+/228397
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Makes it more clear about the `go` format in `go.mod`. I've seen people get pretty confused about that error message.
Change-Id: Ia1d3dd4250edc9b8fbd159c93c68498d7e8fa783
GitHub-Last-Rev: 5e24006775
GitHub-Pull-Request: golang/mod#2
Reviewed-on: https://go-review.googlesource.com/c/mod/+/226438
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
I had thought that the known bug in isVendoredPackage was strictly
conservative, but it turns out not to be.
Updates golang/go#37397
Updates golang/go#31562
Change-Id: I60f6062c41ec2d116766930f751d7df083535355
Reviewed-on: https://go-review.googlesource.com/c/mod/+/220657
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reported by dmitshur in a comment in CL 202042.
Change-Id: I913bd87d9a17a9cf19ac869f8b7166b05e839758
Reviewed-on: https://go-review.googlesource.com/c/mod/+/218237
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Parse and ParseLax now return an ErrorList, which is a slice of Errors
that satisfies the error interface. Each Error now contains a file
name and position. The verb and module path fields are optional.
Fixesgolang/go#36486
Change-Id: I2a244c8753cfce4bb290ddb8bcea5ee73c45f79f
Reviewed-on: https://go-review.googlesource.com/c/mod/+/214430
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rohan Challa <rohan@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
When we add an "indirect" token to a line with an empty comment (only
whitespace after //), we should replace the comment text.
In CL 208273, we inserted "indirect;". The isIndirect predicate returns
false for "// indirect;" because there's only one word. When
modload.WriteGoMod is called multiple times (as it is in
'go mod tidy'), this caused us to write "// indirect; indirect".
Updates golang/go#35737
Change-Id: Ic2531a61ab15df7a0d4462ea3b1d25753d06d1d1
Reviewed-on: https://go-review.googlesource.com/c/mod/+/208671
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>