Documentation
¶
Index ¶
- Variables
- func GoListModules(ctx context.Context, goCommand, mod string) ([]byte, error)
- func RenderTable(w io.Writer, rows []Row, opts Options)
- func Run(ctx context.Context, in io.Reader, out io.Writer, opts Options) error
- type GoListError
- type GoVersionLister
- type MajorUpdate
- type Module
- type ModuleError
- type Options
- type OutputFormat
- type Row
- type VersionLister
Constants ¶
This section is empty.
Variables ¶
var ErrOutdated = errors.New("outdated modules found")
ErrOutdated is returned when CI mode is enabled and at least one update is found.
Functions ¶
func GoListModules ¶
GoListModules runs go list -u -m -json all and returns the JSON stream.
func RenderTable ¶
RenderTable writes rows in the selected table format.
Types ¶
type GoListError ¶
GoListError wraps go list failures that include stderr.
func (*GoListError) Error ¶
func (e *GoListError) Error() string
func (*GoListError) Unwrap ¶
func (e *GoListError) Unwrap() error
type GoVersionLister ¶
GoVersionLister lists module versions by shelling out to go list.
type MajorUpdate ¶
MajorUpdate is the latest discovered major module-path candidate.
func FindMajorUpdate ¶
func FindMajorUpdate(ctx context.Context, modulePath, currentVersion string, lister VersionLister, limit int) (MajorUpdate, error)
FindMajorUpdate probes conventional semantic import version paths for a newer major module candidate.
func (MajorUpdate) String ¶
func (u MajorUpdate) String() string
String returns the module path and version together because v2+ updates often require changing the import path.
type Module ¶
type Module struct {
Path string `json:",omitempty"`
Version string `json:",omitempty"`
Versions []string `json:",omitempty"`
Replace *Module `json:",omitempty"`
Time *time.Time `json:",omitempty"`
Update *Module `json:",omitempty"`
Main bool `json:",omitempty"`
Indirect bool `json:",omitempty"`
Dir string `json:",omitempty"`
GoMod string `json:",omitempty"`
Error *ModuleError `json:",omitempty"`
GoVersion string `json:",omitempty"`
}
Module holds information for one module returned by go list -m -json.
func DecodeModules ¶
DecodeModules decodes the JSON stream returned by go list -m -json.
func (Module) CurrentVersion ¶
CurrentVersion returns the module version, accounting for replace directives.
func (Module) InvalidTimestamp ¶
InvalidTimestamp reports whether go list returned an update older than the current module version timestamp.
func (Module) NewVersion ¶
NewVersion returns the same-path update version, accounting for replace directives.
type ModuleError ¶
type ModuleError struct {
Err string
}
ModuleError represents an error returned by go list for a module.
type Options ¶
type Options struct {
Update bool
Direct bool
Major bool
CI bool
Format OutputFormat
MajorLimit int
MajorConcurrency int
Lister VersionLister
}
Options configures module filtering and rendering.
type OutputFormat ¶
type OutputFormat string
OutputFormat specifies the supported table rendering formats.
const ( // FormatDefault is the default bordered table output. FormatDefault OutputFormat = "default" // FormatMarkdown is a Markdown table. FormatMarkdown OutputFormat = "markdown" )