Skip to content

Commit 244d49f

Browse files
author
Jay Conrod
committed
modfile: clarify documentation for Parse
Fixes golang/go#45149 Change-Id: Ie76f4b46964a99015bcd5c8166c26b25bc61ce72 Reviewed-on: https://go-review.googlesource.com/c/mod/+/308452 Trust: Jay Conrod <[email protected]> Run-TryBot: Jay Conrod <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 1cc8812 commit 244d49f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modfile/rule.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,15 @@ var dontFixRetract VersionFixer = func(_, vers string) (string, error) {
131131
return vers, nil
132132
}
133133

134-
// Parse parses the data, reported in errors as being from file,
135-
// into a File struct. It applies fix, if non-nil, to canonicalize all module versions found.
134+
// Parse parses and returns a go.mod file.
135+
//
136+
// file is the name of the file, used in positions and errors.
137+
//
138+
// data is the content of the file.
139+
//
140+
// fix is an optional function that canonicalizes module versions.
141+
// If fix is nil, all module versions must be canonical (module.CanonicalVersion
142+
// must return the same string).
136143
func Parse(file string, data []byte, fix VersionFixer) (*File, error) {
137144
return parseToFile(file, data, fix, true)
138145
}

0 commit comments

Comments
 (0)