package idsearcher

import "github.com/spdx/tools-golang/idsearcher"

Package idsearcher is used to search for short-form IDs in files within a directory, and to build an SPDX Document containing those license findings. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

Index

Functions

func BuildIDsDocument2_1

func BuildIDsDocument2_1(packageName string, dirRoot string, idconfig *Config2_1) (*spdx.Document2_1, error)

BuildIDsDocument2_1 creates an SPDX Document (version 2.1) and searches for short-form IDs in each file, filling in license fields as appropriate. It returns that document or error if any is encountered. Arguments:

func BuildIDsDocument2_2

func BuildIDsDocument2_2(packageName string, dirRoot string, idconfig *Config2_2) (*spdx.Document2_2, error)

BuildIDsDocument2_2 creates an SPDX Document (version 2.2) and searches for short-form IDs in each file, filling in license fields as appropriate. It returns that document or error if any is encountered. Arguments:

Types

type Config2_1

type Config2_1 struct {
	// NamespacePrefix should be a URI representing a prefix for the
	// namespace with which the SPDX Document will be associated.
	// It will be used in the DocumentNamespace field in the CreationInfo
	// section, followed by the per-Document package name and a random UUID.
	NamespacePrefix string

	// BuilderPathsIgnored lists certain paths to be omitted from the built
	// document. Each string should be a path, relative to the package's
	// dirRoot, to a specific file or (for all files in a directory) ending
	// in a slash. Prefix the string with "**" to omit all instances of that
	// file / directory, regardless of where it is in the file tree.
	BuilderPathsIgnored []string

	// SearcherPathsIgnored lists certain paths that should not be searched
	// by idsearcher, even if those paths have Files present. It uses the
	// same format as BuilderPathsIgnored.
	SearcherPathsIgnored []string
}

Config2_1 is a collection of configuration settings for docbuilder (for version 2.1 SPDX Documents). A few mandatory fields are set here so that they can be repeatedly reused in multiple calls to Build2_1.

type Config2_2

type Config2_2 struct {
	// NamespacePrefix should be a URI representing a prefix for the
	// namespace with which the SPDX Document will be associated.
	// It will be used in the DocumentNamespace field in the CreationInfo
	// section, followed by the per-Document package name and a random UUID.
	NamespacePrefix string

	// BuilderPathsIgnored lists certain paths to be omitted from the built
	// document. Each string should be a path, relative to the package's
	// dirRoot, to a specific file or (for all files in a directory) ending
	// in a slash. Prefix the string with "**" to omit all instances of that
	// file / directory, regardless of where it is in the file tree.
	BuilderPathsIgnored []string

	// SearcherPathsIgnored lists certain paths that should not be searched
	// by idsearcher, even if those paths have Files present. It uses the
	// same format as BuilderPathsIgnored.
	SearcherPathsIgnored []string
}

Config2_2 is a collection of configuration settings for docbuilder (for version 2.2 SPDX Documents). A few mandatory fields are set here so that they can be repeatedly reused in multiple calls to Build2_2.

Source Files

idsearcher.go

Version
v0.3.0
Published
Apr 3, 2022
Platform
windows/amd64
Imports
10 packages
Last checked
9 minutes ago

Tools for package owners.