goup

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

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

Go to latest
Published: Dec 19, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

README

goup

Tool that helps you to retrieve latest Go update from Google

Overview

Goup is a little utility that helps you to check and upgrade your local non-container Go version. It bascially does the following step-by-step:

  1. Run go version to determine local Go version and go env for $GOPATH. The location of go is determined by supplied -p param, $PATH variable or default installation location (/usr/local/go or C:\Go)
  2. Check https://go.googlesource.com/go/+refs to see if there is a version (tags starts with go), compare it against local version retrieved in (1). Can include beta, RC and latest major/minor version for comparison with -b, -rc and -u.
  3. If there is a new version available, download it to temporary directory.
  4. Backup existing Go installtion to temp.
  5. Extract new Go archive to $GOROOT.
  6. In case of an error, reverse backup to $GOROOT.

Compile and run

go get -u github.com/mkishere/goup
go build cmd/goup.go

goup

Documentation

Index

Constants

View Source
const (
	RelVerURL              = "https://go.googlesource.com/go/+refs"
	DownloadURLWithPattern = "https://dl.google.com/go/go[version].[os]-[arch].[ext]"
)
View Source
const (
	Format            = "tar.gz"
	DefaultInstallDir = "/usr/local/go/bin"
)
View Source
const (
	BufSize = 10 * 1024
)

Variables

This section is empty.

Functions

func DownloadPackage

func DownloadPackage(url string, dlCallback func(totalSize int64, src io.Reader) error) (size int64, err error)

DownloadPackage downloads Go compiled binaries from dl.google.com version: Go version arch: Go architecture

func DownloadUrl

func DownloadUrl(version VersionInfo, os, arch string) string

func ExtractArchive

func ExtractArchive(srcFile *os.File, size int64, targetPath string, progCback func(format string, arg ...interface{})) error

func GoPath

func GoPath(exePath string) (string, error)

GoPath extract GOPATH path from `go env` command

func RecursiveCopyDir

func RecursiveCopyDir(src, dst string) error

Types

type VersionInfo

type VersionInfo struct {
	Major       int
	Minor       int
	Build       int
	RC          bool
	RCVersion   int
	Beta        bool
	BetaVersion int
}

func ExtractVersionInfo

func ExtractVersionInfo(version string) (versionInfo VersionInfo, err error)

func LatestVersionInfo

func LatestVersionInfo() (versionInfo []VersionInfo, err error)

LatestVersionInfo returns all version (defined in GoogleSource) available in a slice

func LocalGoInfo

func LocalGoInfo(exePath string) (ver VersionInfo, os, arch string, err error)

LocalGoInfo returns local Go version numbers, OS and Arch

func (VersionInfo) String

func (vi VersionInfo) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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