-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The canonical implementation of this code has now been made available inside the x/mod module, so use that. The API is almost identical, with the exception of `ParseGopkgIn` which isn't there.
- Loading branch information
Showing
7 changed files
with
61 additions
and
1,887 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module github.com/rogpeppe/go-internal | ||
|
||
go 1.19 | ||
|
||
require golang.org/x/mod v0.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= | ||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Package modfile implements parsing and formatting for go.mod files. | ||
// | ||
// This is now just a simple forwarding layer over golang.org/x/mod/modfile | ||
// apart from the ParseGopkgIn function which doesn't exist there. | ||
// | ||
// See that package for documentation. | ||
package modfile | ||
|
||
import ( | ||
"golang.org/x/mod/modfile" | ||
) | ||
|
||
type Position = modfile.Position | ||
type Expr = modfile.Expr | ||
type Comment = modfile.Comment | ||
type Comments = modfile.Comments | ||
type FileSyntax = modfile.FileSyntax | ||
type CommentBlock = modfile.CommentBlock | ||
type Line = modfile.Line | ||
type LineBlock = modfile.LineBlock | ||
type LParen = modfile.LParen | ||
type RParen = modfile.RParen | ||
type File = modfile.File | ||
type Module = modfile.Module | ||
type Go = modfile.Go | ||
type Require = modfile.Require | ||
type Exclude = modfile.Exclude | ||
type Replace = modfile.Replace | ||
type VersionFixer = modfile.VersionFixer | ||
|
||
func Format(f *FileSyntax) []byte { | ||
return modfile.Format(f) | ||
} | ||
|
||
func ModulePath(mod []byte) string { | ||
return modfile.ModulePath(mod) | ||
} | ||
|
||
func Parse(file string, data []byte, fix VersionFixer) (*File, error) { | ||
return modfile.Parse(file, data, fix) | ||
} | ||
|
||
func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) { | ||
return modfile.ParseLax(file, data, fix) | ||
} | ||
|
||
func IsDirectoryPath(ns string) bool { | ||
return modfile.IsDirectoryPath(ns) | ||
} | ||
|
||
func MustQuote(s string) bool { | ||
return modfile.MustQuote(s) | ||
} | ||
|
||
func AutoQuote(s string) string { | ||
return modfile.AutoQuote(s) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.