Versions in this module Expand all Collapse all v1 v1.0.1 Sep 12, 2024 v1.0.0 Jan 28, 2024 Changes in this version + const LatestVersionAlias + const NightlyVersionAlias + var ErrPropSuggestion = errorx.RegisterProperty("suggestion") + var ErrTraitPreCheck = errorx.RegisterTrait("pre_check") + var ErrValidateChecksum = &HashValidationErr + func CheckSHA256(reader io.Reader, sha string) error + func Checksum(file string) (string, error) + func Copy(src, dst string) error + func FmtVer(ver string) (string, error) + func IsEmptyDir(path string) (bool, error) + func IsExecBinary(path string) bool + func IsExist(path string) bool + func IsNotExist(path string) bool + func IsSubDir(parent, sub string) bool + func IsSymExist(path string) bool + func IsTimeoutOrMaxRetry(err error) bool + func JoinHostPort(host string, port int) string + func MkdirAll(path string, minPerm os.FileMode) error + func Move(src, dst string) error + func ParseHostPort(hostport string) (host, port string) + func Retry(doFunc func() error, opts ...RetryOption) error + func RetryUntil(f func() error, when func(error) bool) error + func SHA256(reader io.Reader) (string, error) + func SHA512(reader io.Reader) (string, error) + func SaveFileWithBackup(path string, data []byte, backupDir string) error + func TailN(fname string, n int) (lines []string, err error) + func Tar(writer io.Writer, from string) error + func Ternary(condition bool, a, b any) any + func Untar(reader io.Reader, to string) error + func UserHome() string + func WriteFile(name string, data []byte, perm os.FileMode) error + type HTTPClient struct + func NewHTTPClient(timeout time.Duration, tlsConfig *tls.Config) *HTTPClient + func (c *HTTPClient) Client() *http.Client + func (c *HTTPClient) Delete(ctx context.Context, url string, body io.Reader) ([]byte, int, error) + func (c *HTTPClient) Download(ctx context.Context, url, filePath string) error + func (c *HTTPClient) Get(ctx context.Context, url string) ([]byte, error) + func (c *HTTPClient) GetWithStatusCode(ctx context.Context, url string) ([]byte, int, error) + func (c *HTTPClient) Post(ctx context.Context, url string, body io.Reader) ([]byte, error) + func (c *HTTPClient) PostWithStatusCode(ctx context.Context, url string, body io.Reader) ([]byte, int, error) + func (c *HTTPClient) Put(ctx context.Context, url string, body io.Reader) ([]byte, int, error) + func (c *HTTPClient) SetRequestHeader(key, value string) + func (c *HTTPClient) WithClient(client *http.Client) *HTTPClient + type HashValidationErr struct + func (e *HashValidationErr) Error() string + func (e *HashValidationErr) Is(target error) bool + func (e *HashValidationErr) Unwrap() error + type RetryOption struct + Attempts int64 + Delay time.Duration + Timeout time.Duration + type Version string + func (v Version) IsEmpty() bool + func (v Version) IsNightly() bool + func (v Version) IsValid() bool + func (v Version) String() string