internal

package
v0.0.0-...-5bc7645 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "go-libyear"

Variables

This section is empty.

Functions

func GetDefaultCacheBasePath

func GetDefaultCacheBasePath() (string, error)

func ReadGoMod

func ReadGoMod(content []byte) (mainModule *Module, modules []*Module, err error)

Types

type Cache

type Cache struct {
	Modules map[string]*Module
	// contains filtered or unexported fields
}

func NewCache

func NewCache(filePath string) (*Cache, error)

func (*Cache) Has

func (c *Cache) Has(m *Module) bool

func (*Cache) Load

func (c *Cache) Load(path string, version *semver.Version) (module *Module, loaded bool)

func (*Cache) Save

func (c *Cache) Save(m *Module) error

type DepsDevClient

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

func NewDepsDevClient

func NewDepsDevClient() *DepsDevClient

func (DepsDevClient) GetVersions

func (c DepsDevClient) GetVersions(path string) ([]*semver.Version, error)

type GitCmd

type GitCmd struct{}

GitCmd is a wrapper over git command calls.

func (GitCmd) Checkout

func (g GitCmd) Checkout(path, tag string) error

func (GitCmd) Clone

func (g GitCmd) Clone(url, path string) error

func (GitCmd) GetHeadBranchName

func (g GitCmd) GetHeadBranchName(path string) (string, error)

func (GitCmd) ListTags

func (g GitCmd) ListTags(path string) (io.Reader, error)

func (GitCmd) Pull

func (g GitCmd) Pull(path string) error

type GitCmdI

type GitCmdI interface {
	Clone(url, path string) error
	Pull(path string) error
	ListTags(path string) (io.Reader, error)
	Checkout(path, tag string) error
	GetHeadBranchName(path string) (string, error)
}

type GitHandler

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

GitHandler is a module handler for git version control system.

func NewGitVCS

func NewGitVCS(cacheDir string, git GitCmdI) *GitHandler

func (*GitHandler) CanHandle

func (g *GitHandler) CanHandle(path string) (bool, error)

func (*GitHandler) GetInfo

func (g *GitHandler) GetInfo(path string, version *semver.Version) (*Module, error)

func (*GitHandler) GetLatestInfo

func (g *GitHandler) GetLatestInfo(path string) (*Module, error)

func (*GitHandler) GetModFile

func (g *GitHandler) GetModFile(path string, version *semver.Version) ([]byte, error)

func (*GitHandler) GetVersions

func (g *GitHandler) GetVersions(path string) ([]*semver.Version, error)

func (*GitHandler) Name

func (g *GitHandler) Name() string

type GoListExecutor

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

func NewGoListExecutor

func NewGoListExecutor(useCache bool, cacheFilePath string) (*GoListExecutor, error)

func (*GoListExecutor) GetInfo

func (e *GoListExecutor) GetInfo(path string, version *semver.Version) (*Module, error)

func (*GoListExecutor) GetLatestInfo

func (e *GoListExecutor) GetLatestInfo(path string) (*Module, error)

func (*GoListExecutor) GetModFile

func (e *GoListExecutor) GetModFile(_ string, _ *semver.Version) ([]byte, error)

func (*GoListExecutor) GetVersions

func (e *GoListExecutor) GetVersions(path string) ([]*semver.Version, error)

type GoProxyClient

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

GoProxyClient is used to interact with Golang proxy server. Details on GOPROXY protocol can be found here: https://go.dev/ref/mod#goproxy-protocol.

func NewGoProxyClient

func NewGoProxyClient(useCache bool, cacheFilePath string) (*GoProxyClient, error)

func (*GoProxyClient) GetInfo

func (c *GoProxyClient) GetInfo(path string, version *semver.Version) (*Module, error)

func (*GoProxyClient) GetLatestInfo

func (c *GoProxyClient) GetLatestInfo(path string) (*Module, error)

func (*GoProxyClient) GetModFile

func (c *GoProxyClient) GetModFile(path string, version *semver.Version) ([]byte, error)

func (*GoProxyClient) GetVersions

func (c *GoProxyClient) GetVersions(path string) ([]*semver.Version, error)

type Module

type Module struct {
	Path    string          `json:"Path"`
	Version *semver.Version `json:"Version"`
	Time    time.Time       `json:"Time"`

	Indirect bool    `json:"-"`
	Skipped  bool    `json:"-"`
	Latest   *Module `json:"-"`
	Libyear  float64 `json:"-"`
	// ReleasesDiff is the number of release versions between latest and current.
	ReleasesDiff int `json:"-"`
	// VersionsDiff is an array of 3 elements: major, minor and patch versions.
	VersionsDiff VersionsDiff `json:"-"`
	// AllPaths preceding this version, if any.
	// This field is only set for latest version.
	AllPaths []string `json:"-"`
}

Module is a container used to decode GOPROXY and 'go list' responses and transport calculated metrics.

type VersionsDiff

type VersionsDiff [3]int64

func (VersionsDiff) Add

func (VersionsDiff) String

func (v VersionsDiff) String() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳