utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepoWithGit

func CloneRepoWithGit(ctx context.Context, repoURL, targetDir string) error

CloneRepoWithGit clones a GitHub repository using the Git command-line tool.

func ConvertToJSON

func ConvertToJSON(inputPath, outputDir string) (string, error)

convertToJSON converts SBOM content to JSON format and saves with .json extension

func GetBinaryPath

func GetBinaryPath() (string, error)

func IsValidURL

func IsValidURL(input string) bool

isValidURL checks if the given string is a valid URL

func ParseGithubURL

func ParseGithubURL(githubURL string) (owner, repo, version string, err error)

ParseGithubURL extracts the repository owner, repo name, and it's version. For URLs like "https://github.com/interlynk-io/sbomqs@v1.0.0", returns "interlynk-io", "sbomqs", "v1.0.0", nil). For URLs like "https://github.com/interlynk-io/sbomqs", returns "interlynk-io", "sbomqs", "", nil). For URLs like "https://github.com/interlynk-io/", returns "interlynk-io", "", "", nil).

func ParseRepoVersion

func ParseRepoVersion(repoURL string) (string, string, error)

ParseRepoVersion extracts the repository URL without version and version from a GitHub URL. For URLs like "https://github.com/owner/repo", returns ("https://github.com/owner/repo", "latest", nil). For URLs like "https://github.com/owner/repo@v1.0.0", returns ("https://github.com/owner/repo", "v1.0.0", nil).

Types

This section is empty.

Jump to

Keyboard shortcuts

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