license

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 21 Imported by: 5

Documentation

Index

Constants

View Source
const (
	SkipLicenses    = "skipLicenses"
	IncludeLicenses = "includeLicenses"
	CheckLicenses   = "checkLicenses"
)
View Source
const (
	MITForm       = "MIT License"
	Apache2_0Form = "Apache License 2.0"
)

Variables

View Source
var CommonReplacements = []string{
	"k8s.io", "github.com/kubernetes",
	"golang.org/x", "github.com/golang",
	"go.uber.org", "github.com/uber-go",
	"cloud.google.com/go", "github.com/googleapis/google-cloud-go",
	"google.golang.org/grpc", "github.com/grpc/grpc-go",
	"istio.io", "github.com/istio",
	"contrib.go.opencensus.io/exporter/prometheus", "github.com/census-ecosystem/opencensus-go-exporter-prometheus",
	"google.golang.org/genproto", "github.com/googleapis/go-genproto",
	"sigs.k8s.io", "github.com/kubernetes-sigs",
	"knative.dev", "github.com/knative",
}

Functions

func Cli added in v0.0.4

func Cli(pkgs, depsToSkip []string) *cobra.Command

examines licenses of dependencies for any package in the pkgs array dependencies that are in depsToSkip are not analyzed (for example, github.com/mitchellh/go-homedir which is needed in mac but not linux)

func CliAllPackages added in v0.0.6

func CliAllPackages(depsToSkip []string) (*cobra.Command, error)

`go list -e ./...` is run to determine all packages necessary to examine the dependencies of

func CommonOverrides

func CommonOverrides(pkg, candidate string) string

func GetTemplatesSet

func GetTemplatesSet() (map[string]interface{}, error)

func PrintLicenses

func PrintLicenses() error

func PrintLicensesWithOptions

func PrintLicensesWithOptions(opts *Options) error

Types

type CliOptions added in v0.0.4

type CliOptions struct {
	LicensesToSkip      []string
	LicensesToInclude   []string
	LicensesToCheck     []string
	IncludeIndirectDeps bool
}

type GlooProductLicenseHandler added in v0.0.4

type GlooProductLicenseHandler struct {
	LicensesToProcess  map[string]interface{}
	DependenciesToSkip []string
}

func NewGlooProductLicenseHandler added in v0.0.4

func NewGlooProductLicenseHandler(depsToSkip []string, licensesToProcess map[string]interface{}) *GlooProductLicenseHandler

func (*GlooProductLicenseHandler) ExtraLicenses added in v0.0.4

func (lh *GlooProductLicenseHandler) ExtraLicenses() []License

func (*GlooProductLicenseHandler) OverrideLicense added in v0.0.4

func (lh *GlooProductLicenseHandler) OverrideLicense(pkg, licenseCandidate string) string

func (*GlooProductLicenseHandler) ReplacementList added in v0.0.4

func (lh *GlooProductLicenseHandler) ReplacementList() []string

func (*GlooProductLicenseHandler) SkipLicense added in v0.0.4

func (lh *GlooProductLicenseHandler) SkipLicense(l License) bool

type License

type License struct {
	Package  string
	Score    float64
	Template *Template
	Path     string
	// ManualPath indicates the URI of the license file. If provided, overrides the auto-generated URI path
	ManualPath   string
	Err          string
	ExtraWords   []string
	MissingWords []string
	// text from the license file
	FileContent []byte
}

type LicenseValidator added in v0.0.4

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

func NewLicenseValidator added in v0.0.4

func NewLicenseValidator() (*LicenseValidator, error)

type MatchResult

type MatchResult struct {
	Template     *Template
	Score        float64
	ExtraWords   []string
	MissingWords []string
	FileContent  []byte
}

type MissingError

type MissingError struct {
	Err string
}

func (*MissingError) Error

func (err *MissingError) Error() string

type Options

type Options struct {
	RunAll                  bool
	Words                   bool
	PrintConfidence         bool
	UseCsv                  bool
	UseMarkdown             bool
	IncludeIndirectDeps     bool
	PrunePath               string
	HelperListGlooPkgs      bool
	ConsolidatedLicenseFile string
	Pkgs                    []string
	Product                 Product
}

type PkgError

type PkgError struct {
	Err string
}

type PkgInfo

type PkgInfo struct {
	Name       string
	Dir        string
	Root       string
	ImportPath string
	Version    string
	Error      *PkgError
}

type Product

type Product interface {
	// determines if a license should be skipped
	// sample reason for skipping: a library is only used on MacOS, not in Linux, which is the environment of the deployed process
	SkipLicense(license License) bool

	// This library generates license lists from binary dependencies but may exclude some external dependencies (such as EnvoyProxy)
	ExtraLicenses() []License

	// Replacements returns an even-length list of strings representing an old and new string
	ReplacementList() []string

	// If the automated tool is unable to correctly categorize a license you can override it with this function
	OverrideLicense(pkg, license string) string
}

type Template

type Template struct {
	Title    string
	Nickname string
	Words    map[string]int
}

type Word

type Word struct {
	Text string
	Pos  int
}

Jump to

Keyboard shortcuts

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