utils

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0, GPL-2.0, CC-BY-4.0 Imports: 12 Imported by: 4

Documentation

Overview

Package utils contains various utility functions to support the main tools-golang packages. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

Package utils contains various utility functions to support the main tools-golang packages. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllFilePaths

func GetAllFilePaths(dirRoot string, pathsIgnored []string) ([]string, error)

GetAllFilePaths takes a path to a directory (including an optional slice of path patterns to ignore), and returns a slice of relative paths to all files in that directory and its subdirectories (excluding those that are ignored). These paths are always normalized to use URI-like forward-slashes but begin with /

func GetHashesForFilePath

func GetHashesForFilePath(p string) (string, string, string, error)

GetHashesForFilePath takes a path to a file on disk, and returns SHA1, SHA256 and MD5 hashes for that file as strings.

func GetVerificationCode added in v0.5.0

func GetVerificationCode(files []*spdx.File, excludeFile string) (common.PackageVerificationCode, error)

GetVerificationCode takes a slice of files and an optional filename for an "excludes" file, and returns a Package Verification Code calculated according to SPDX spec version 2.3, section 3.9.4.

func ShouldIgnore

func ShouldIgnore(fileName string, pathsIgnored []string) bool

ShouldIgnore compares a file path to a slice of file path patterns, and determines whether that file should be ignored because it matches any of those patterns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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