代码拉取完成,页面将自动刷新
make format
to standardize your code style before the code is submitted.golangci-lint run # Enable default rules with fewer rules
golangci-lint run --enable-all # Enable all rules, too many rules
go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest
# Perform compilation
go mod tidy
# Perform unit tests
go test ./... -v -coverprofile=cover.out
# Generate unit test report and coverage
go tool cover -html=cover.out -o coverage.html
gocov convert cover.out | gocov-xml > coverage.xml
type PreProcessor interface {
Name() string
ProcessContent(content string) string
SupportedFileTypes() []string
}
func AllPreProcessors() []preprocessor.PreProcessor {
return []preprocessor.PreProcessor{
cpp.NewCppPreprocessor(),
}
}
type Collector interface {
GetName() string
GetPurlType() string
GetParsers() []FileParser
TryToAccept(file File)
GetRequests() []Request
Collect() (pkgs []model.Package, err error)
}
type FileParser interface {
Matcher() FileMatcher
Parse(path string) (pkgs []model.Package, err error)
}
func init() {
pckg.RegisterPackageParser(NewXxxFileParser())
pckg.RegisterPackageParser(NewYyyFileParser())
}
func AllCollectors() []collector.Collector {
var allCollectors []collector.Collector
allCollectors = append(allCollectors, cargo.NewCollector())
allCollectors = append(allCollectors, carthage.NewCollector())
return allCollectors
}
// Spec is a sbom specfication
type Spec interface {
Name() string // Name returns the spec name
Version() string // Version returns the spec version
Validate() error // Validate validates the spec
Formats() []Format // Formats returns all formats of this spec
FromSBOM(*sbom.SBOM) // FromSBOM converts a sbom to spec
ToSBOM() *sbom.SBOM // ToSBOM converts spec to a sbom
}
// Format is a sbom file format
type Format interface {
Spec() Spec // Spec returns the spec of this format
Type() string // Type returns the format type
Load(reader io.Reader) error // Load loads a sbom from reader
Dump(writer io.Writer) error // Dump dumps a sbom to writer
}
func init() {
s := &SpdxSpec{}
s.formats = []spec.Format{
&JsonFormat{spec: s},
&TagValueFormat{spec: s},
}
spec.Register(s)
}
func AllSpecifications() []format.Specification {
return []format.Specification{
spdx.NewSpecification(),
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。