govm

package module
v0.0.0-...-d51f384 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

govm

Go version manager.

Install

go install github.com/harrybrwn/govm

Usage

Download a version of go.

govm download 1.19.3

List all downloaded versions of go.

govm ls

Manually select a version.

gvm use 1.19.3

Select a version using a config file.

echo '1.18.5' > .govm
govm use

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidVersion = errors.New("invalid version")

Functions

func CurrentVersion

func CurrentVersion(dir string) (string, error)

func GetGoVersions

func GetGoVersions() ([]string, error)

Types

type Manager

type Manager struct {
	// Base is the base directory of all other paths.
	Base string
	// GoDir is the directory name of the Go installation relative to Base.
	GoDir         string
	VersionsDir   string
	BuildCacheDir string
	VersionFile   string
}

func NewDefaultManager

func NewDefaultManager() Manager

func (*Manager) Download

func (m *Manager) Download(stdout io.Writer, version string) error

func (*Manager) Installation

func (m *Manager) Installation(v string) string

func (*Manager) List

func (m *Manager) List() (VersionList, error)

func (*Manager) Uninstall

func (m *Manager) Uninstall() (err error)

func (*Manager) Use

func (m *Manager) Use(version string) error

type Version

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

func ParseVersion

func ParseVersion(str string) (v Version, err error)

func ReadVersionFile

func ReadVersionFile(filename string) (*Version, error)

func (*Version) Cmp

func (v *Version) Cmp(x *Version) int

Cmp will compare the two sematic version numbers.

func (*Version) String

func (v *Version) String() string

type VersionList

type VersionList []Version

VersionList is a sortable list of semantic version numbers.

func (VersionList) Len

func (vl VersionList) Len() int

func (VersionList) Less

func (vl VersionList) Less(i, j int) bool

func (VersionList) Swap

func (vl VersionList) Swap(i, j int)

Directories

Path Synopsis
cmd
gen

Jump to

Keyboard shortcuts

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