Documentation
¶
Index ¶
- Variables
- func CalculateSHA256(filePath string) (string, error)
- func CheckIsFileWritable(path string) error
- func CheckMajorMinor(version string) error
- func ChooseLatestVersion(version string, channel string, availableVersions []string, ...) (string, error)
- func ChooseLatestVersionSimple(availableVersions []string) (string, error)
- func ExecUpdatedBinary(path string) error
- func FileExists(dir string, name string) (bool, error)
- func GetSelfExecutableInfo() (path string, err error)
- func LoadHashFile(dir string, fileName string) (hashes map[string]string)
- func PrintErrorScript() error
- func PrintUseScript(info BinaryInfo) error
- func ReleaseFiles(pkg string, version string, osArch string) map[string]string
- func ReplaceBinaryFile(dir string, currentName string, newName string) (err error)
- func SelfUpdate(messages chan ActionMessage) string
- func TildeExpand(path string) (string, error)
- func Update(version string, channel string, args []string) error
- func Use(version string, channel string, args []string) error
- func VerifyReleaseFileHash(dir string, hashFile string, targetFile string) (bool, error)
- type ActionMessage
- type BinaryInfo
Constants ¶
This section is empty.
Variables ¶
var AvailableChannels = []string{
"alpha",
"beta",
"rc",
"stable",
}
Functions ¶
func CalculateSHA256 ¶
func CheckIsFileWritable ¶
func CheckMajorMinor ¶
CheckMajorMinor return error if string not in form MAJOR.MINOR
func ChooseLatestVersion ¶
func ChooseLatestVersion(version string, channel string, availableVersions []string, availableChannels []string) (string, error)
ChooseLatestVersion returns a latest version from availableVersions that suits version and channel constrain.
version is a constrain on MAJOR and MINOR parts
channel is a constrain on Prerelease part
availableChannels is an array of prioritized Prerelease variants
func ChooseLatestVersionSimple ¶
ChooseLatestVersionSimple returns a latest version from availableVersions array
func ExecUpdatedBinary ¶
ExecUpdatedBinary replaces current process with process from path binary --self-update=no flag is added to arguments to prevent an infinity loop.
func GetSelfExecutableInfo ¶
GetSelfExecutableInfo return path of an executable file of current process. If file is not owned by user of the process and has no 0x400 bit — return error
func PrintErrorScript ¶
func PrintErrorScript() error
func PrintUseScript ¶
func PrintUseScript(info BinaryInfo) error
TODO Add script block to prevent from loading not in bash/zsh shells (as in rvm script)
func ReplaceBinaryFile ¶
func SelfUpdate ¶
func SelfUpdate(messages chan ActionMessage) string
func TildeExpand ¶
Types ¶
type ActionMessage ¶
type ActionMessage struct {
// contains filtered or unexported fields
}
use and update actions send messages
type BinaryInfo ¶
func UpdateBinary ¶
func UpdateBinary(version string, channel string, messages chan ActionMessage) (binInfo BinaryInfo)
1. Check for new version → print version 2. Check hashes existed binaries → print 'version stays' 3. Download and check if no binaries are existed — print 'updated to'