internal

package
v0.0.0-...-fd01e3d Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStatusNotOK   = errors.New("status not ok")
	ErrLoadingModule = errors.New("loading module")
)

Functions

func Debugf

func Debugf(format string, v ...any)

Debugf writes debug logs.

func EnableDebug

func EnableDebug()

EnableDebug enables debug logs.

func Infof

func Infof(format string, v ...any)

Infof writes info logs.

Types

type Fetcher

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

func NewFetcher

func NewFetcher() *Fetcher

func NewFetcherWithClient

func NewFetcherWithClient(client HTTPClient) *Fetcher

func (*Fetcher) FetchLicenses

func (f *Fetcher) FetchLicenses(ctx context.Context, modules Modules) <-chan License

FetchLicenses searches the licenses of the modules from pkg.go.dev.

type GoListLoader

type GoListLoader struct{}

GoListLoader requires go list command.

func (*GoListLoader) Load

func (*GoListLoader) Load() (Modules, error)

type GoModLoader

type GoModLoader struct{}

GoModLoader requires go.mod file.

func (*GoModLoader) Load

func (*GoModLoader) Load() (Modules, error)

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type License

type License interface {
	URI() string
	Module() *Module
	Source() string
	Content() string
	Type() string
	Err() error
}

type Loader

type Loader interface {
	// Load loads and returns the Go modules.
	Load() (Modules, error)
}

type Module

type Module struct {
	Path     string // module path
	Version  string // module version
	Indirect bool   // indirect dependency?
	Error    any    // error on loading module
}

func (*Module) String

func (m *Module) String() string

type Modules

type Modules []*Module

func (Modules) Filter

func (ms Modules) Filter(p func(*Module) bool) Modules

func (Modules) ForEach

func (ms Modules) ForEach(f func(*Module))

func (Modules) RemoveError

func (ms Modules) RemoveError() Modules

func (Modules) RemoveIndirect

func (ms Modules) RemoveIndirect() Modules

Jump to

Keyboard shortcuts

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