versions

package
v0.11.3-genericstreaming Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CompatibilityCheckExitCode = 3
)

Variables

View Source
var (
	ErrGoCmdNotFound                   = errors.New("go cmd not found")
	ErrGoModNotFound                   = errors.New("go.mod file not found in current directory or any parent directory")
	ErrDependencyNotFound              = errors.New("dependency not found")
	ErrDependencyVersionNotCompatible  = errors.New("dependency not compatible")
	ErrDependencyVersionNotSemantic    = errors.New("dependency version is not semantic version")
	ErrDependencyReplacedWithLocalRepo = errors.New("dependency replaced with local repo")
)

Functions

func DefaultCheckDependencyAndProcess

func DefaultCheckDependencyAndProcess() error

DefaultCheckDependencyAndProcess provided default processing procedure to parse CheckResult and prompt users

func RegisterMinDepVersion

func RegisterMinDepVersion(depVer *MinDepVersion) error

RegisterMinDepVersion registers Minimal Dependency Version to be checked

Types

type CheckResult

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

func CheckDependency

func CheckDependency() *CheckResult

CheckDependency is responsible for checking the compatibility of dependency and return the checking results. After calling CheckDependencies(), you should check if the result is Nil:

res := CheckDependency()
if res != nil {
}

If res is not nil, pls check the related error with `Err()`:

	if err := res.Err(); err != nil {
	    switch {
        case errors.Is(err, ErrGoCmdNotFound):
        case errors.Is(err, ErrGoModNotFound):
	    case errors.Is(err, ErrDependencyNotFound):
	    case errors.Is(err, ErrDependencyVersionNotSemantic):
	    case errors.Is(err, ErrDependencyReplacedWithLocalRepo):
	    case errors.Is(err, ErrDependencyVersionNotCompatible):
	    }
	}

Then you can get the version in go.mod with `GoModVersion()` and retrieve the MinDepVersion information with `MinDepVersion()`.

func (*CheckResult) Err

func (cr *CheckResult) Err() error

Err returns the error in checking process

func (*CheckResult) GoModVersion

func (cr *CheckResult) GoModVersion() string

GoModVersion returns the version of the dependency in the go.mod

func (*CheckResult) MinDepVersion

func (cr *CheckResult) MinDepVersion() *MinDepVersion

type MinDepVersion

type MinDepVersion struct {
	// RefPath is the reference path to the dependency
	// e.g. github.com/cloudwego/kitex
	RefPath string
	// Version is the minimal required version
	Version string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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