golang

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MinimumGoVersion = "1.13.0"
)

Variables

This section is empty.

Functions

func IsValidVersion

func IsValidVersion(version string) bool

func VerifyGoVersion

func VerifyGoVersion(minimumGoVersion string) error

Types

type DownloadModule

type DownloadModule struct {
	Path     string // module path
	Version  string // module version
	Error    string // error loading module
	Info     string // absolute path to cached .info file
	GoMod    string // absolute path to cached .mod file
	Zip      string // absolute path to cached .zip file
	Dir      string // absolute path to cached source root directory
	Sum      string // checksum for path, version (as in go.sum)
	GoModSum string // checksum for go.mod (as in go.sum)
}

type GoMod

type GoMod struct {
	Module  ModModule
	Go      string
	Require []Require
	Exclude []ModModule
	Replace []Replace
}

type GomodHelper

type GomodHelper struct {
	// contains filtered or unexported fields
}

func NewGomodHelper

func NewGomodHelper(modfile string, logger logr.Logger) *GomodHelper

func (*GomodHelper) EditDropreplace

func (g *GomodHelper) EditDropreplace(path string) error

func (*GomodHelper) EditReplace

func (g *GomodHelper) EditReplace(oldPath, newPath, version string) error

func (*GomodHelper) EditRequire

func (g *GomodHelper) EditRequire(path, version string) error

func (*GomodHelper) Format

func (g *GomodHelper) Format() error

func (*GomodHelper) ModDownload

func (g *GomodHelper) ModDownload(path, version string) (*DownloadModule, error)

func (*GomodHelper) ModTidy

func (g *GomodHelper) ModTidy() error

func (*GomodHelper) ParseListMod

func (g *GomodHelper) ParseListMod() ([]ListModule, error)

func (*GomodHelper) ParseMod

func (g *GomodHelper) ParseMod() (*GoMod, error)

func (*GomodHelper) PruneAndTidy

func (g *GomodHelper) PruneAndTidy() error

PruneAndTidy 1. ensures all existing 'require' directives have an associated 'replace' directive pinning a version

  • adds explicit 'require' directives for all transitive dependencies
  • adds explicit 'replace' directives for all require directives

2. prune replace directives that pin to the naturally selected version. 3. format and tidy go.mod

func (*GomodHelper) Replace

func (g *GomodHelper) Replace(oldPath, newPath, version string) error

func (*GomodHelper) Require

func (g *GomodHelper) Require(path, version string, skipDeps bool) error

type ListModule

type ListModule struct {
	Path      string       // module path
	Version   string       // module version
	Versions  []string     // available module versions (with -versions)
	Replace   *ListModule  // replaced by this module
	Time      *time.Time   // time version was created
	Update    *ListModule  // available update, if any (with -u)
	Main      bool         // is this the main module?
	Indirect  bool         // is this module only an indirect dependency of main module?
	Dir       string       // directory holding files for this module, if any
	GoMod     string       // path to go.mod file used when loading this module, if any
	GoVersion string       // go version used in module
	Error     *ModuleError // error loading module
}

type ModModule

type ModModule struct {
	Path    string
	Version string
}

type ModeEditVerb

type ModeEditVerb string
const (
	EditRequire     ModeEditVerb = "require"
	EditReplace     ModeEditVerb = "replace"
	EditDropreplace ModeEditVerb = "dropreplace"
)

type ModuleError

type ModuleError struct {
	Err string // the error itself
}

type Replace

type Replace struct {
	Old ModModule
	New ModModule
}

type Require

type Require struct {
	Path     string
	Version  string
	Indirect bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL