mod

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: MPL-2.0, MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareSum

func CompareSum(src, dst *Sum) (errs []error)

CompareSum verifies each go.sum hash in the destination matches the source's.

func SyncRequire

func SyncRequire(src, dst *Mod) (errs []error)

SyncRequire overwrites each go.mod `require (...)` version in the destination with the source's.

Types

type Mod

type Mod struct {
	// Path is from the `module <path>` directive.
	Path string

	// Go is the `go` directive value.
	Go string
	// contains filtered or unexported fields
}

func NewMod

func NewMod(r io.Reader) (m *Mod, err error)

func NewModFromFile

func NewModFromFile(name string) (m *Mod, err error)

func (*Mod) DelRequire

func (m *Mod) DelRequire(importPath string) (found bool)

func (*Mod) GetRequire

func (m *Mod) GetRequire(importPath string) (require ModRequire, found bool)

func (*Mod) Replaces

func (m *Mod) Replaces() (r []ModReplace)

Replace returns all `replace` directives in the order they were read.

func (*Mod) Requires

func (m *Mod) Requires() (r []ModRequire)

Require returns all `require (...)` directives in the order they were read.

func (*Mod) SetRequire

func (m *Mod) SetRequire(importPath string, require ModRequire)

SetRequire overwrites the identified require's fields with new values.

func (*Mod) String

func (m *Mod) String() string

type ModReplace

type ModReplace struct {
	// Old is the replaced import path.
	Old string

	// New is the replacement path.
	New string

	// Version holds the optional version selection.
	Version string
}

ModReplace defines one `replace` directive.

func (ModReplace) String

func (r ModReplace) String() string

type ModRequire

type ModRequire struct {
	// Comment is the substring found after the version. If a comment was present, it contains
	// the leading space.
	Comment string

	// Path is an import path.
	Path string

	// Version holds the version substring.
	Version string
}

ModRequire defines one line of the `require (...)` directive block.

func (ModRequire) String

func (r ModRequire) String() string

type Sum

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

func NewSum

func NewSum(r io.Reader) (s *Sum, err error)

func (*Sum) GetHash

func (s *Sum) GetHash(importPath, version string) string

func (*Sum) GetLines

func (s *Sum) GetLines() (lines []SumLine)

Lines returns SumLine values in the order they were read during NewSum.

type SumLine

type SumLine struct {
	Path    string
	Version string
	Hash    string
}

Jump to

Keyboard shortcuts

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