source

package
v0.2.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GithubAPIBaseURL = "https://api.github.com"

GithubAPIBaseURL allows overriding for tests. It is an exported variable.

View Source
var GithubAPIBaseURLMutex sync.Mutex // Mutex for GithubAPIBaseURL (Exported)
View Source
var TestModeBypassHostValidationMutex sync.Mutex // Mutex for testModeBypassHostValidation (Exported)

Functions

func GetLatestCommitSHAForFile

func GetLatestCommitSHAForFile(owner, repo, pathInRepo, ref string) (string, error)

GetLatestCommitSHAForFile fetches the latest commit SHA for a specific file on a given branch/ref from GitHub. owner: repository owner repo: repository name pathInRepo: path to the file within the repository ref: branch name, tag name, or commit SHA

func SetTestModeBypassHostValidation

func SetTestModeBypassHostValidation(enable bool)

SetTestModeBypassHostValidation enables or disables the hostname validation bypass for testing. This function is intended to be called only from test packages.

Types

type GitHubCommitInfo

type GitHubCommitInfo struct {
	SHA    string `json:"sha"`
	Commit struct {
		Committer struct {
			Date time.Time `json:"date"`
		} `json:"committer"`
	} `json:"commit"`
}

GitHubCommitInfo minimal structure to parse the commit SHA.

type ParsedSourceInfo

type ParsedSourceInfo struct {
	RawURL            string
	CanonicalURL      string
	Ref               string
	Provider          string
	Owner             string
	Repo              string
	PathInRepo        string
	SuggestedFilename string
}

ParsedSourceInfo holds the details extracted from a source URL.

func ParseSourceURL

func ParseSourceURL(sourceURL string) (*ParsedSourceInfo, error)

ParseSourceURL analyzes the input source URL string and returns structured information. It currently prioritizes GitHub URLs.

Jump to

Keyboard shortcuts

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