Documentation
¶
Index ¶
- func AppendDoubleSlashDot(uri string) string
- func ContainsTripleSlash(uri string) bool
- func CopyToTarget(srcDir, dstDir string, opts CopyOptions) error
- func CreateSkipFunc(srcDir string, includedPaths, excludedPaths []string) func(os.FileInfo, string, string) (bool, error)
- func HasLocalPathPrefix(uri string) bool
- func HasSchemeSeparator(uri string) bool
- func HasSubdirectory(uri string) bool
- func HasSubdirectoryDelimiter(uri string) bool
- func IsDomainLikeURI(uri string) bool
- func IsFileURI(uri string) bool
- func IsGitURI(uri string) bool
- func IsLocalPath(uri string) bool
- func IsNonGitHTTPURI(uri string) bool
- func IsOCIURI(uri string) bool
- func IsS3URI(uri string) bool
- func NeedsDoubleSlashDot(uri string) bool
- func NormalizeURI(uri string) string
- func ParseSubdirFromTripleSlash(uri string) (source string, subdir string)
- func SanitizeFileName(uri string) string
- func ShouldExcludeFile(excludedPaths []string, trimmedSrc string) (bool, error)
- func ShouldIncludeFile(includedPaths []string, trimmedSrc string) (bool, error)
- type CopyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendDoubleSlashDot ¶
AppendDoubleSlashDot adds double-slash-dot to a URI, handling query parameters correctly.
func ContainsTripleSlash ¶
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 ¶
HasLocalPathPrefix checks if the URI starts with local path prefixes.
func HasSchemeSeparator ¶
HasSchemeSeparator checks if the URI contains a scheme separator.
func HasSubdirectory ¶
HasSubdirectory checks if the URI already has a subdirectory delimiter.
func HasSubdirectoryDelimiter ¶
HasSubdirectoryDelimiter checks if the URI contains the go-getter subdirectory delimiter.
func IsDomainLikeURI ¶
IsDomainLikeURI checks if the URI has a domain-like structure (hostname.domain/path).
func IsGitURI ¶
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 ¶
IsLocalPath checks if the URI is a local file system path.
func IsNonGitHTTPURI ¶
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 IsS3URI ¶
IsS3URI checks if the URI is an S3 URI. Go-getter supports both explicit s3:: prefix and auto-detected .amazonaws.com URLs.
func NeedsDoubleSlashDot ¶
NeedsDoubleSlashDot determines if a URI needs double-slash-dot appended.
func NormalizeURI ¶
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 ¶
ParseSubdirFromTripleSlash extracts source and subdirectory from a triple-slash URI.
func SanitizeFileName ¶
SanitizeFileName makes a URI safe for use as a filename.
func ShouldExcludeFile ¶
ShouldExcludeFile checks if the file matches any of the excluded 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.