tweak fields of Release struct and add docs for them
This commit is contained in:
parent
9c8dc3199b
commit
0c3940241c
|
@ -23,7 +23,7 @@ func selfUpdate() error {
|
|||
fmt.Println("Current binary is the latest version", version)
|
||||
} else {
|
||||
fmt.Println("Update successfully done to version", latest.Version)
|
||||
fmt.Println("Release note:\n", latest.Description)
|
||||
fmt.Println("Release note:\n", latest.ReleaseNotes)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -113,9 +113,9 @@ func (d *ReleaseDetector) DetectLatest(slug string) (release *Release, found boo
|
|||
}
|
||||
|
||||
release = &Release{
|
||||
AssetURL: url,
|
||||
DocumentURL: rel.GetHTMLURL(),
|
||||
Description: rel.GetBody(),
|
||||
AssetURL: url,
|
||||
URL: rel.GetHTMLURL(),
|
||||
ReleaseNotes: rel.GetBody(),
|
||||
}
|
||||
|
||||
release.Version, err = semver.Make(tag)
|
||||
|
|
|
@ -32,10 +32,10 @@ func TestDetectReleaseWithVersionPrefix(t *testing.T) {
|
|||
if !strings.HasSuffix(r.AssetURL, ".zip") && !strings.HasSuffix(r.AssetURL, ".tar.gz") {
|
||||
t.Error("Incorrect URL for asset:", r.AssetURL)
|
||||
}
|
||||
if r.DocumentURL == "" {
|
||||
if r.URL == "" {
|
||||
t.Error("Document URL should not be empty")
|
||||
}
|
||||
if r.Description == "" {
|
||||
if r.ReleaseNotes == "" {
|
||||
t.Error("Description should not be empty for this repo")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,12 @@ import (
|
|||
|
||||
// Release represents a release asset for current OS and arch.
|
||||
type Release struct {
|
||||
Version semver.Version
|
||||
AssetURL string
|
||||
DocumentURL string
|
||||
Description string
|
||||
// Version is the version of the release
|
||||
Version semver.Version
|
||||
// AssetURL is a URL to the uploaded file for the release
|
||||
AssetURL string
|
||||
// URL is a URL to release page for browsing
|
||||
URL string
|
||||
// ReleaseNotes is a release notes of the release
|
||||
ReleaseNotes string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue