Documentation
¶
Index ¶
- Constants
- func DefaultVersionResolverConfig(installParams any) (string, any, error)
- func DeriveGitHubRepo(module string) string
- func DeriveRepoURL(module string) (string, error)
- func IsInstallMethod(method string) bool
- func IsLocalModule(module string) bool
- type Installer
- type InstallerParameters
- type SourceMode
Constants ¶
const InstallMethod = "go-build"
Variables ¶
This section is empty.
Functions ¶
func DefaultVersionResolverConfig ¶
DefaultVersionResolverConfig returns the default version resolver configuration for the given install parameters. For local modules, it uses the git resolver. For GitHub modules, it uses the github-release resolver. For other modules, it falls back to the goproxy resolver.
func DeriveGitHubRepo ¶
DeriveGitHubRepo extracts the owner/repo portion from a GitHub module path. Returns empty string for non-GitHub modules.
func DeriveRepoURL ¶
DeriveRepoURL derives the git repository URL from a Go module path. For GitHub modules, it constructs the HTTPS URL. For other hosts, it returns an error asking for an explicit repo-url.
func IsInstallMethod ¶
IsInstallMethod returns true if the given method string refers to the go-build installer.
func IsLocalModule ¶
IsLocalModule returns true if the module path refers to a local filesystem path.
Types ¶
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer builds Go binaries from source code obtained via git or go proxy.
func NewInstaller ¶
func NewInstaller(cfg InstallerParameters) Installer
NewInstaller creates a new go-build installer with the given configuration.
type InstallerParameters ¶
type InstallerParameters struct {
Module string `json:"module" yaml:"module" mapstructure:"module"`
Entrypoint string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty" mapstructure:"entrypoint"`
LDFlags []string `json:"ldflags,omitempty" yaml:"ldflags,omitempty" mapstructure:"ldflags"`
Args []string `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args"`
Env []string `json:"env,omitempty" yaml:"env,omitempty" mapstructure:"env"`
Source SourceMode `json:"source,omitempty" yaml:"source,omitempty" mapstructure:"source"`
RepoURL string `json:"repo-url,omitempty" yaml:"repo-url,omitempty" mapstructure:"repo-url"`
}
InstallerParameters contains the configuration for building a Go module from source.
type SourceMode ¶
type SourceMode string
SourceMode indicates how to obtain the source code for building.
const ( // SourceModeGit clones the repository using git. SourceModeGit SourceMode = "git" // SourceModeGoProxy downloads source via the go proxy. SourceModeGoProxy SourceMode = "go-proxy" )