package forge import ( "fmt" "net/url" "strings" ) type Forge string const ( ForgeGitea Forge = "gitea" ForgeGitHub Forge = "github" ) type Release struct { Name string Assets []Asset } type Asset struct { Name string DownloadURL string } type Forger interface { Name() string Latest() (Release, error) } func splitURI(uri string) (string, []string, error) { u, err := url.ParseRequestURI(uri) if err != nil { return "", nil, fmt.Errorf("could not parse URI: %w", err) } u.Scheme = "https" paths := strings.FieldsFunc(u.Path, func(r rune) bool { return r == '/' }) u.Path = "" return u.String(), paths, nil }