Documentation
¶
Index ¶
- Variables
- func Purl(vendor, name, version string, language Language) string
- func ReadLine(reader io.Reader, do func(line string))
- func ReadLineNoComment(reader io.Reader, t *CommentType, do func(line string))
- type BomSWComponent
- type BomSWDocument
- type CommentType
- type CreationInfo
- type DepGraph
- func (dep *DepGraph) AppendChild(child *DepGraph)
- func (dep *DepGraph) AppendLicense(lic string)
- func (dep *DepGraph) Build(deep bool, lan Language)
- func (dep *DepGraph) Flush()
- func (dep *DepGraph) ForEach(deep, path, name bool, do func(p, n *DepGraph) bool)
- func (dep *DepGraph) ForEachNode(do func(p, n *DepGraph) bool)
- func (dep *DepGraph) ForEachPath(do func(p, n *DepGraph) bool)
- func (dep *DepGraph) Index() string
- func (dep *DepGraph) RemoveChild(child *DepGraph)
- func (dep *DepGraph) RemoveDevelop()
- func (dep *DepGraph) String() string
- func (dep *DepGraph) Tree(path, name bool) string
- type DepGraphMap
- type DsdxComponent
- type DsdxDependencies
- type DsdxDocument
- type ExternalRef
- type File
- type Language
- type Relationship
- type ResCallback
- type SpdxDocument
- type SpdxPackage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // C语言注释类型 CTypeComment = &CommentType{ Simple: "//", Begin: "/*", End: "*/", } // Python语言注释类型 PythonTypeComment = &CommentType{ Simple: "#", Begin: "'''", End: "'''", } )
Functions ¶
func ReadLineNoComment ¶
func ReadLineNoComment(reader io.Reader, t *CommentType, do func(line string))
ReadLineNoComment 按行读取内容 忽略注释
Types ¶
type BomSWComponent ¶ added in v3.0.8
type BomSWComponent struct {
Author map[string]string `json:"componentAuthor"`
Provider map[string]string `json:"componentProvider"`
Name string `json:"componentName"`
Version string `json:"componentVersion"`
// map[hash算法]hash值
HashValue []swChecksumValue `json:"componentHashValue"`
ID string `json:"componentId"`
License []string `json:"license"`
// 组件信息更新时间 yyyy-MM-ddTHH:mm:ssTZD
Timestamp string `json:"componentTimestamp"`
}
type BomSWDocument ¶ added in v3.0.8
type BomSWDocument struct {
Basic swBasicInfo `json:"documentBasicInfo"`
Software swSoftwareCompositionInfo `json:"softwareCompositionInfo"`
SbomHashCheck string `json:"BOM-SW1.0-SBOM-HASH"`
}
func NewBomSWDocument ¶ added in v3.0.8
func NewBomSWDocument(name, creator string) *BomSWDocument
func (*BomSWDocument) AppendComponents ¶ added in v3.0.8
func (doc *BomSWDocument) AppendComponents(fn func(*BomSWComponent))
func (*BomSWDocument) AppendDependencies ¶ added in v3.0.8
func (doc *BomSWDocument) AppendDependencies(parentId string, childrenIds []string)
type CommentType ¶
注释类型
type CreationInfo ¶
type DepGraph ¶
type DepGraph struct {
// 厂商
Vendor string
// 名称
Name string
// 版本号
Version string
// 语言
Language Language
// 检出路径
Path string
// 许可证
Licenses []string
// 仅用于开发环境
Develop bool
// 直接依赖
Direct bool
// 父节点
Parents []*DepGraph
// 子节点
Children []*DepGraph
// 附加信息
Expand any
// contains filtered or unexported fields
}
DepGraph 依赖关系图
func (*DepGraph) AppendLicense ¶
func (*DepGraph) Build ¶
Build 构建依赖图路径 deep: 依赖路径构建顺序 true=>深度优先 false=>广度优先 广度优先的路径更短 如果不清楚该用什么推荐false lan: 更新依赖语言
func (*DepGraph) ForEach ¶
ForEach 遍历依赖图 deep: true=>深度优先 false=>广度优先 path: true=>遍历所有路径 false=>遍历所有节点 name: true=>按名称顺序迭代子节点 false=>按添加顺序迭代子节点 do: 对当前节点的操作 返回true代表继续迭代子节点 do.p: 路径父节点 do.n: 路径子节点
func (*DepGraph) ForEachNode ¶
ForEachNode 遍历依赖图节点
func (*DepGraph) ForEachPath ¶
ForEachPath 遍历依赖图路径
type DepGraphMap ¶
type DepGraphMap struct {
// contains filtered or unexported fields
}
func NewDepGraphMap ¶
func NewDepGraphMap(key func(...string) string, store func(...string) *DepGraph) *DepGraphMap
func (*DepGraphMap) LoadOrStore ¶
func (s *DepGraphMap) LoadOrStore(words ...string) *DepGraph
type DsdxComponent ¶
type DsdxComponent struct {
// DSDX-xxx
ID string `json:"id" xml:"id"`
Group string `json:"group,omitempty" xml:"group,omitempty"`
Name string `json:"name" xml:"name"`
Version string `json:"version" xml:"version"`
Language string `json:"language,omitempty" xml:"language,omitempty"`
License []string `json:"license,omitempty" xml:"license,omitempty"`
}
type DsdxDependencies ¶
type DsdxDocument ¶
type DsdxDocument struct {
// 文档名称
Name string `json:"name" xml:"name"`
// 创作者
Creator string `json:"creator" xml:"creator"`
// dsdx版本 DSDX-1.0
DSDXVersion string `json:"dsdx_version" xml:"dsdx_version"`
// 文档创建时间 yyyy-MM-dd HH:mm:ss
CreateTime string `json:"create_time" xml:"create_time"`
// dsdx文档标识 自动生成 DSDX-${Name}-${Version}-${CreateTime}
DSDXID string `json:"dsdx_id" xml:"dsdx_id"`
// 项目名称
ProjectName string `json:"project_name" xml:"project_name"`
// 组件列表
Components []DsdxComponent `json:"components" xml:"components"`
// 依赖关系
Dependencies DsdxDependencies `json:"dependencies" xml:"-"`
}
func NewDsdxDocument ¶
func NewDsdxDocument(name, creator string) *DsdxDocument
func (*DsdxDocument) AppendComponents ¶
func (doc *DsdxDocument) AppendComponents(id, group, name, version, language string, license []string)
func (*DsdxDocument) AppendDependencies ¶
func (doc *DsdxDocument) AppendDependencies(parentId string, childrenIds []string)
type ExternalRef ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File 文件相关信息
func (*File) OpenReader ¶
OpenReader 打开文件reader
func (File) ReadLineNoComment ¶
func (file File) ReadLineNoComment(t *CommentType, do func(line string))
ReadLineNoComment 按行读取文件内容 忽略注释
type Relationship ¶
type ResCallback ¶
ResCallback 检测结果回调函数 file: 检出组件的文件信息 root: 组件依赖图根节点列表
type SpdxDocument ¶
type SpdxDocument struct {
Namespace string `json:"documentNamespace" xml:"documentNamespace"`
SPDXVersion string `json:"spdxVersion" xml:"spdxVersion"`
SPDXID string `json:"SPDXID" xml:"SPDXID"`
DocumentName string `json:"name" xml:"name"`
CreationInfo CreationInfo `json:"creationInfo" xml:"creationInfo"`
Packages []SpdxPackage `json:"packages" xml:"packages"`
Relationships []Relationship `json:"relationships" xml:"relationships"`
}
func NewSpdxDocument ¶
func NewSpdxDocument(name string) *SpdxDocument
func (*SpdxDocument) AddPackage ¶
func (doc *SpdxDocument) AddPackage(id, vendor, name, version string, language Language, lics []string)
func (*SpdxDocument) AddRelation ¶
func (doc *SpdxDocument) AddRelation(parentId, childId string)
type SpdxPackage ¶
type SpdxPackage struct {
SPDXID string `json:"SPDXID" xml:"SPDXID"`
Name string `json:"name" xml:"name"`
Version string `json:"versionInfo,omitempty" xml:"versionInfo,omitempty"`
Supplier string `json:"supplier,omitempty" xml:"supplier,omitempty"`
ExternalRefs []ExternalRef `json:"externalRefs" xml:"externalRefs"`
// 从文件中解析的许可证名称不符合spdx规范
LicenseConcluded string `json:"-" xml:"-"`
}
Click to show internal directories.
Click to hide internal directories.