Documentation
¶
Overview ¶
Package golang provides a concrete Cataloger implementation relating to packages within the Go language ecosystem.
Index ¶
- func NewGoModuleBinaryCataloger(opts CatalogerConfig) pkg.Cataloger
- func NewGoModuleFileCataloger(opts CatalogerConfig) pkg.Cataloger
- type CatalogerConfig
- func (g CatalogerConfig) WithLocalModCacheDir(input string) CatalogerConfig
- func (g CatalogerConfig) WithLocalVendorDir(input string) CatalogerConfig
- func (g CatalogerConfig) WithMainModuleVersion(input MainModuleVersionConfig) CatalogerConfig
- func (g CatalogerConfig) WithNoProxy(input string) CatalogerConfig
- func (g CatalogerConfig) WithProxy(input string) CatalogerConfig
- func (g CatalogerConfig) WithSearchLocalModCacheLicenses(input bool) CatalogerConfig
- func (g CatalogerConfig) WithSearchLocalVendorLicenses(input bool) CatalogerConfig
- func (g CatalogerConfig) WithSearchRemoteLicenses(input bool) CatalogerConfig
- type MainModuleVersionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGoModuleBinaryCataloger ¶ added in v0.25.0
func NewGoModuleBinaryCataloger(opts CatalogerConfig) pkg.Cataloger
NewGoModuleBinaryCataloger returns a new cataloger object that searches within binaries built by the go compiler.
func NewGoModuleFileCataloger ¶ added in v0.95.0
func NewGoModuleFileCataloger(opts CatalogerConfig) pkg.Cataloger
NewGoModuleFileCataloger returns a new cataloger object that searches within go.mod files.
Types ¶
type CatalogerConfig ¶ added in v0.98.0
type CatalogerConfig struct {
// SearchLocalModCacheLicenses enables searching for go package licenses in the local GOPATH mod cache.
// app-config: golang.search-local-mod-cache-licenses
SearchLocalModCacheLicenses bool `yaml:"search-local-mod-cache-licenses" json:"search-local-mod-cache-licenses" mapstructure:"search-local-mod-cache-licenses"`
// LocalModCacheDir specifies the location of the local go module cache directory. When not set, syft will attempt to discover the GOPATH env or default to $HOME/go.
// app-config: golang.local-mod-cache-dir
LocalModCacheDir string `yaml:"local-mod-cache-dir" json:"local-mod-cache-dir" mapstructure:"local-mod-cache-dir"`
// SearchLocalVendorLicenses enables searching for go package licenses in the local vendor directory relative to the go.mod file.
// app-config: golang.search-local-vendor-licenses
SearchLocalVendorLicenses bool `yaml:"search-local-vendor-licenses" json:"search-local-vendor-licenses" mapstructure:"search-local-vendor-licenses"`
// LocalVendorDir specifies the location of the local vendor directory. When not set, syft will search for a vendor directory relative to the go.mod file.
// app-config: golang.local-vendor-dir
LocalVendorDir string `yaml:"local-vendor-dir" json:"local-vendor-dir" mapstructure:"local-vendor-dir"`
// SearchRemoteLicenses enables downloading go package licenses from the upstream go proxy (typically proxy.golang.org).
// app-config: golang.search-remote-licenses
SearchRemoteLicenses bool `yaml:"search-remote-licenses" json:"search-remote-licenses" mapstructure:"search-remote-licenses"`
// Proxies is a list of go module proxies to use when fetching go module metadata and licenses. When not set, syft will use the GOPROXY env or default to https://proxy.golang.org,direct.
// app-config: golang.proxy
Proxies []string `yaml:"proxies,omitempty" json:"proxies,omitempty" mapstructure:"proxies"`
// NoProxy is a list of glob patterns that match go module names that should not be fetched from the go proxy. When not set, syft will use the GOPRIVATE and GONOPROXY env vars.
// app-config: golang.no-proxy
NoProxy []string `yaml:"no-proxy,omitempty" json:"no-proxy,omitempty" mapstructure:"no-proxy"`
MainModuleVersion MainModuleVersionConfig `yaml:"main-module-version" json:"main-module-version" mapstructure:"main-module-version"`
}
func DefaultCatalogerConfig ¶ added in v0.98.0
func DefaultCatalogerConfig() CatalogerConfig
DefaultCatalogerConfig create a CatalogerConfig with default options, which includes: - setting the default remote proxy if none is provided - setting the default no proxy if none is provided - setting the default local module cache dir if none is provided
func (CatalogerConfig) WithLocalModCacheDir ¶ added in v0.98.0
func (g CatalogerConfig) WithLocalModCacheDir(input string) CatalogerConfig
func (CatalogerConfig) WithLocalVendorDir ¶ added in v1.19.0
func (g CatalogerConfig) WithLocalVendorDir(input string) CatalogerConfig
func (CatalogerConfig) WithMainModuleVersion ¶ added in v0.105.0
func (g CatalogerConfig) WithMainModuleVersion(input MainModuleVersionConfig) CatalogerConfig
func (CatalogerConfig) WithNoProxy ¶ added in v0.98.0
func (g CatalogerConfig) WithNoProxy(input string) CatalogerConfig
func (CatalogerConfig) WithProxy ¶ added in v0.98.0
func (g CatalogerConfig) WithProxy(input string) CatalogerConfig
func (CatalogerConfig) WithSearchLocalModCacheLicenses ¶ added in v0.98.0
func (g CatalogerConfig) WithSearchLocalModCacheLicenses(input bool) CatalogerConfig
func (CatalogerConfig) WithSearchLocalVendorLicenses ¶ added in v1.19.0
func (g CatalogerConfig) WithSearchLocalVendorLicenses(input bool) CatalogerConfig
func (CatalogerConfig) WithSearchRemoteLicenses ¶ added in v0.98.0
func (g CatalogerConfig) WithSearchRemoteLicenses(input bool) CatalogerConfig
type MainModuleVersionConfig ¶ added in v0.105.0
type MainModuleVersionConfig struct {
// FromLDFlags enables parsing the main module version from the -ldflags build settings.
// app-config: golang.main-module-version.from-ld-flags
FromLDFlags bool `yaml:"from-ld-flags" json:"from-ld-flags" mapstructure:"from-ld-flags"`
// FromContents enables parsing the main module version from the binary contents. This is useful when the version is embedded in the binary but not in the build settings.
// app-config: golang.main-module-version.from-contents
FromContents bool `yaml:"from-contents" json:"from-contents" mapstructure:"from-contents"`
// FromBuildSettings enables parsing the main module version from the go build settings.
// app-config: golang.main-module-version.from-build-settings
FromBuildSettings bool `yaml:"from-build-settings" json:"from-build-settings" mapstructure:"from-build-settings"`
}
func DefaultMainModuleVersionConfig ¶ added in v0.105.0
func DefaultMainModuleVersionConfig() MainModuleVersionConfig
func (MainModuleVersionConfig) WithFromBuildSettings ¶ added in v0.105.0
func (g MainModuleVersionConfig) WithFromBuildSettings(input bool) MainModuleVersionConfig
func (MainModuleVersionConfig) WithFromContents ¶ added in v0.105.0
func (g MainModuleVersionConfig) WithFromContents(input bool) MainModuleVersionConfig
func (MainModuleVersionConfig) WithFromLDFlags ¶ added in v0.105.0
func (g MainModuleVersionConfig) WithFromLDFlags(input bool) MainModuleVersionConfig
Source Files
¶
Click to show internal directories.
Click to hide internal directories.