vendor

package
v1.210.0-test.11 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendDoubleSlashDot

func AppendDoubleSlashDot(uri string) string

AppendDoubleSlashDot adds double-slash-dot to a URI, handling query parameters correctly.

func ContainsTripleSlash

func ContainsTripleSlash(uri string) bool

ContainsTripleSlash checks if the URI contains the triple-slash pattern.

func CopyToTarget

func CopyToTarget(srcDir, dstDir string, opts CopyOptions) error

CopyToTarget copies files from srcDir to dstDir with include/exclude pattern filtering. This is the single shared code path for all vendoring operations (vendor.yaml, component.yaml, and source provisioning).

It supports POSIX-style Globs for file names/paths (double-star ** is supported). https://en.wikipedia.org/wiki/Glob_(programming) https://github.com/bmatcuk/doublestar#patterns

func CreateSkipFunc

func CreateSkipFunc(srcDir string, includedPaths, excludedPaths []string) func(os.FileInfo, string, string) (bool, error)

CreateSkipFunc builds a skip function for otiai10/copy that applies include/exclude patterns. It supports POSIX-style Globs for file names/paths (double-star ** is supported).

func HasLocalPathPrefix

func HasLocalPathPrefix(uri string) bool

HasLocalPathPrefix checks if the URI starts with local path prefixes.

func HasSchemeSeparator

func HasSchemeSeparator(uri string) bool

HasSchemeSeparator checks if the URI contains a scheme separator.

func HasSubdirectory

func HasSubdirectory(uri string) bool

HasSubdirectory checks if the URI already has a subdirectory delimiter.

func HasSubdirectoryDelimiter

func HasSubdirectoryDelimiter(uri string) bool

HasSubdirectoryDelimiter checks if the URI contains the go-getter subdirectory delimiter.

func IsDomainLikeURI

func IsDomainLikeURI(uri string) bool

IsDomainLikeURI checks if the URI has a domain-like structure (hostname.domain/path).

func IsFileURI

func IsFileURI(uri string) bool

IsFileURI checks if the URI is a file:// scheme.

func IsGitURI

func IsGitURI(uri string) bool

IsGitURI checks if the URI appears to be a Git repository URL. Detection rules: 1. Explicit git:: prefix. 2. SCP-style URLs (git@github.com:owner/repo.git). 3. Known Git hosting platforms (github.com, gitlab.com, bitbucket.org) in host. 4. .git extension in path (not in host). 5. Azure DevOps _git/ pattern in path.

func IsLocalPath

func IsLocalPath(uri string) bool

IsLocalPath checks if the URI is a local file system path.

func IsNonGitHTTPURI

func IsNonGitHTTPURI(uri string) bool

IsNonGitHTTPURI checks if the URI is an HTTP/HTTPS URL that doesn't appear to be a Git repository. It detects archive extensions and known-host file download/raw content URL patterns.

func IsOCIURI

func IsOCIURI(uri string) bool

IsOCIURI checks if the URI is an OCI registry URI.

func IsS3URI

func IsS3URI(uri string) bool

IsS3URI checks if the URI is an S3 URI. Go-getter supports both explicit s3:: prefix and auto-detected .amazonaws.com URLs.

func NeedsDoubleSlashDot

func NeedsDoubleSlashDot(uri string) bool

NeedsDoubleSlashDot determines if a URI needs double-slash-dot appended.

func NormalizeURI

func NormalizeURI(uri string) string

NormalizeURI normalizes vendor source URIs to handle all patterns consistently. It converts triple-slash patterns, appends double-slash-dot to Git URLs without subdirectory, and skips normalization for special URI types (file, oci, S3, local).

func ParseSubdirFromTripleSlash

func ParseSubdirFromTripleSlash(uri string) (source string, subdir string)

ParseSubdirFromTripleSlash extracts source and subdirectory from a triple-slash URI.

func SanitizeFileName

func SanitizeFileName(uri string) string

SanitizeFileName makes a URI safe for use as a filename.

func ShouldExcludeFile

func ShouldExcludeFile(excludedPaths []string, trimmedSrc string) (bool, error)

ShouldExcludeFile checks if the file matches any of the excluded patterns.

func ShouldIncludeFile

func ShouldIncludeFile(includedPaths []string, trimmedSrc string) (bool, error)

ShouldIncludeFile checks if the file matches any of the included patterns.

Types

type CopyOptions

type CopyOptions struct {
	// IncludedPaths are POSIX-style glob patterns for files to include (double-star ** supported).
	IncludedPaths []string
	// ExcludedPaths are POSIX-style glob patterns for files to exclude (double-star ** supported).
	ExcludedPaths []string
}

CopyOptions configures the copy+filter behavior for vendoring operations.

Jump to

Keyboard shortcuts

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