internal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanicLevel logrus.Level = iota
	FatalLevel
	ErrorLevel
	WarnLevel
	InfoLevel
	DebugLevel
	TraceLevel
)
View Source
const GO_DL_SERVER = "https://go.dev/dl"
View Source
const LTS = "lts"

Variables

View Source
var (
	ErrReleaseNotFound = errors.New("release not found")
	ErrBadResponse     = errors.New("github API responde with a non success code")
	ErrEmptyTags       = errors.New("no tags found")
	ErrHashNotFound    = errors.New("release hash not found")
	ErrHashInvalid     = errors.New("release hash doesn't match")
)

Functions

func CopyFolder

func CopyFolder(src, dst string, init bool) error

func UpdateRelease

func UpdateRelease(activeRelease, releaseFolder string) error

Types

type Alias

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

func (*Alias) GetAliasVersion

func (a *Alias) GetAliasVersion(alias string) string

func (*Alias) GetAllAlias

func (a *Alias) GetAllAlias() map[string]string

func (*Alias) RenameAlias

func (a *Alias) RenameAlias(old, new string) error

func (*Alias) SetAlias

func (a *Alias) SetAlias(alias, version string)

func (*Alias) WriteAliasFile

func (a *Alias) WriteAliasFile() error

type Aliaser

type Aliaser interface {
	GetAliasVersion(alias string) string
	GetAllAlias() map[string]string
	SetAlias(alias, version string)
	RenameAlias(old, new string) error
	WriteAliasFile() error
}

func NewAlias

func NewAlias(path string) (Aliaser, error)

type Hash

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

func (*Hash) AddHash

func (h *Hash) AddHash(path, hash string) error

AddHash adds a hash to the hash table by writing the "hashTable" property and the file.

func (*Hash) CompareReleaseHash

func (h *Hash) CompareReleaseHash(path, hash string) error

CompareReleaseHash compares the hash of the release with the hash in the hash table.

func (*Hash) GetFolderHash

func (h *Hash) GetFolderHash(path string) (string, error)

GetFolderHash returns the hash of the folder by using the Merkle tree.

func (*Hash) RemoveHash

func (h *Hash) RemoveHash(path string) error

RemoveHash removes a hash from the hash table.

func (*Hash) ReplaceHash

func (h *Hash) ReplaceHash(path, hash string) error

ReplaceHash replaces the hash in the hash table with the new hash.

type HashActions

type HashActions interface {
	GetFolderHash(path string) (string, error)
	CompareReleaseHash(path string, hash string) error
	AddHash(path, hash string) error
	ReplaceHash(path, hash string) error
	RemoveHash(path string) error
	// contains filtered or unexported methods
}

func NewHash

func NewHash(hashFile string) (HashActions, error)

NewHash returns a new Hash object. It reads the hashes from the ~/.local/doggofetcher/hashes.txt file then loads them into the hash table.

type LoggerFormatter

type LoggerFormatter struct{}

func (*LoggerFormatter) Format

func (f *LoggerFormatter) Format(e *logrus.Entry) ([]byte, error)

type Release

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

func (*Release) CheckReleaseExists

func (d *Release) CheckReleaseExists() error

CheckReleaseExists checks if the release exists in doggofetcher folder

func (*Release) DownloadRelease

func (d *Release) DownloadRelease() error

DownloadRelease downloads the golang release

func (*Release) ExtractRelease

func (d *Release) ExtractRelease() error

ExtractRelease extracts the golang release

func (*Release) GetReleaseFolder

func (d *Release) GetReleaseFolder() string

GetReleaseFolder returns the release folder

type ReleaseActions

type ReleaseActions interface {
	DownloadRelease() error
	ExtractRelease() error
	CheckReleaseExists() error
	GetReleaseFolder() string
	// contains filtered or unexported methods
}

func NewRelease

func NewRelease(release, releaseFolder string) ReleaseActions

NewRelease returns a Release object

type Tags

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

func (*Tags) GetRelease

func (t *Tags) GetRelease(beta, rc bool) (string, error)

GetRelease retrieves tags from "golang/go" and check whether the given release exists in it

Returns the found release or an error

func (*Tags) GetTagsRef

func (t *Tags) GetTagsRef() ([]*github.Reference, error)

GetTagsRef retrieves all tags from golang/go

Returns a list of tags reference if there is as least one or an error otherwise.

type TagsAction

type TagsAction interface {
	GetRelease(beta, rc bool) (string, error)
	GetTagsRef() ([]*github.Reference, error)
	// contains filtered or unexported methods
}

func NewTags

func NewTags(release string, ctx context.Context) TagsAction

Jump to

Keyboard shortcuts

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