Documentation ¶
Index ¶
- func GoTidy(files []ModFileContent)
- func PrintError(message string)
- func PrintErrorCommand(message string)
- func PrintErrorPanic(message string)
- func PrintGoModFile(file GoModFile) string
- func PrintHeader(message string)
- func PrintInfo(message string)
- type Dependency
- type Exclude
- type GoModFile
- type ModFileContent
- type Replacement
- type Statement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoTidy ¶
func GoTidy(files []ModFileContent)
func PrintErrorPanic ¶
func PrintErrorPanic(message string)
Prints a formatted error and exit with non-zero status code
func PrintGoModFile ¶
Prints a go.mod file from the struct representation of the go.mod file
Types ¶
type Dependency ¶
type Dependency struct { ModuleName string `@String` Version string `(@Version | @"latest")` Comment *string `("//" @String)?` }
A struct that represents a go.mod dependency
type Exclude ¶
type Exclude struct {
Dependency Dependency `@@`
}
type GoModFile ¶
type GoModFile struct { Module string `"module" @String` Statements []Statement `@@*` GoVersion *string Requirements []Dependency Replacements []Replacement Excludes []Exclude }
The root level object that represents a go.mod file
type ModFileContent ¶
type Replacement ¶
type Replacement struct { FromModule string `@String Version? "=>"` ToModule Dependency `@@` }
A struct that represents a replace directive
type Statement ¶
type Statement struct { GoVersion *string `( "go" @String )` Requirements []Dependency `| (("require" "(" @@* ")") | ("require" @@))` Replacements []Replacement `| (("replace" "(" @@* ")") | ("replace" @@))` Excludes []Exclude `| (("exclude" "(" @@* ")") | ("exclude" @@))` }
Click to show internal directories.
Click to hide internal directories.