utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSHA added in v1.0.0

func CheckSHA(reader io.Reader, sha string) error

CheckSHA returns error if the hash of reader content mismatches `sha`

func CheckSHA256 added in v1.0.0

func CheckSHA256(reader io.Reader, sha string) error

CheckSHA256 returns an error if the hash of reader mismatches `sha`

func Copy added in v1.0.0

func Copy(src, dst string) error

Copy copy file from src to dst

func FmtVer

func FmtVer(ver string) (string, error)

FmtVer converts a version string to SemVer format, if the string is not a valid SemVer and fails to parse and convert it, an error is raised.

func GetFreePort

func GetFreePort(host string, priority int) (int, error)

GetFreePort asks the kernel for a free open port that is ready to use.

func IsEmptyDir added in v1.0.0

func IsEmptyDir(path string) (bool, error)

IsEmptyDir check whether a path is an empty directory

func IsExist

func IsExist(path string) bool

IsExist check whether a path is exist

func IsNotExist

func IsNotExist(path string) bool

IsNotExist check whether a path is not exist

func Move added in v1.0.0

func Move(src, dst string) error

Move moves a file from src to dst, this is done by copying the file and then delete the old one. Use os.Rename() to rename file within the same filesystem instead this, it's more lightweight but can not be used across devices.

func MustGetFreePort

func MustGetFreePort(host string, priority int) int

MustGetFreePort asks the kernel for a free open port that is ready to use, if fail, panic

func RebuildArgs added in v1.0.0

func RebuildArgs(args []string) []string

RebuildArgs move "--help" or "-h" flag to the end of the arg list

func Untar

func Untar(reader io.Reader, to string) error

Untar decompresses the tarball

Types

This section is empty.

Jump to

Keyboard shortcuts

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