mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
scripts/build/*: Fix golint issues Url => URL
$ gometalinter --vendor --disable-all --enable=golint ./... | grep -i URL build/publish.go:18:5⚠️ var apiUrl should be apiURL (golint) build/publish.go:184:2⚠️ struct field WhatsNewUrl should be WhatsNewURL (golint) build/publish.go:185:2⚠️ struct field ReleaseNotesUrl should be ReleaseNotesURL (golint) build/publish.go:191:2⚠️ struct field Url should be URL (golint) build/release_publisher/externalrelease.go:17:53⚠️ method parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/externalrelease.go:17:69⚠️ method parameter whatsNewUrl should be whatsNewURL (golint) build/release_publisher/externalrelease.go:17:89⚠️ method parameter releaseNotesUrl should be releaseNotesURL (golint) build/release_publisher/localrelease.go:20:45⚠️ method parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/localrelease.go:20:61⚠️ method parameter whatsNewUrl should be whatsNewURL (golint) build/release_publisher/localrelease.go:20:81⚠️ method parameter releaseNotesUrl should be releaseNotesURL (golint) build/release_publisher/localrelease.go:45:41⚠️ method parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/localrelease.go:51:84⚠️ func parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/main.go:12:6⚠️ var whatsNewUrl should be whatsNewURL (golint) build/release_publisher/main.go:13:6⚠️ var releaseNotesUrl should be releaseNotesURL (golint) build/release_publisher/main.go:40:6⚠️ var baseUrl should be baseURL (golint) build/release_publisher/main.go:94:6⚠️ func createBaseUrl should be createBaseURL (golint) build/release_publisher/publisher.go:21:2⚠️ struct field baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/publisher.go:26:17⚠️ interface method parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/publisher.go:26:33⚠️ interface method parameter whatsNewUrl should be whatsNewURL (golint) build/release_publisher/publisher.go:26:53⚠️ interface method parameter releaseNotesUrl should be releaseNotesURL (golint) build/release_publisher/publisher.go:29:31⚠️ method parameter whatsNewUrl should be whatsNewURL (golint) build/release_publisher/publisher.go:29:51⚠️ method parameter releaseNotesUrl should be releaseNotesURL (golint) build/release_publisher/publisher.go:91:24⚠️ method getUrl should be getURL (golint) build/release_publisher/publisher.go:91:31⚠️ method parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/publisher.go:190:15⚠️ func parameter baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/publisher.go:199:21⚠️ method apiUrl should be apiURL (golint) build/release_publisher/publisher.go:257:2⚠️ struct field WhatsNewUrl should be WhatsNewURL (golint) build/release_publisher/publisher.go:258:2⚠️ struct field ReleaseNotesUrl should be ReleaseNotesURL (golint) build/release_publisher/publisher.go:264:2⚠️ struct field Url should be URL (golint) build/release_publisher/publisher_test.go:10:3⚠️ struct field whatsNewUrl should be whatsNewURL (golint) build/release_publisher/publisher_test.go:11:3⚠️ struct field relNotesUrl should be relNotesURL (golint) build/release_publisher/publisher_test.go:17:3⚠️ struct field expectedUrl should be expectedURL (golint) build/release_publisher/publisher_test.go:18:3⚠️ struct field baseArchiveUrl should be baseArchiveURL (golint) build/release_publisher/publisher_test.go:109:2⚠️ var whatsNewUrl should be whatsNewURL (golint) build/release_publisher/publisher_test.go:110:2⚠️ var relNotesUrl should be relNotesURL (golint)
This commit is contained in:

committed by
Leonard Gram

parent
674ab73806
commit
d5f63d9988
@ -4,12 +4,13 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type publisher struct {
|
||||
@ -18,16 +19,16 @@ type publisher struct {
|
||||
product string
|
||||
dryRun bool
|
||||
enterprise bool
|
||||
baseArchiveUrl string
|
||||
baseArchiveURL string
|
||||
builder releaseBuilder
|
||||
}
|
||||
|
||||
type releaseBuilder interface {
|
||||
prepareRelease(baseArchiveUrl, whatsNewUrl string, releaseNotesUrl string, nightly bool) (*release, error)
|
||||
prepareRelease(baseArchiveURL, whatsNewURL string, releaseNotesURL string, nightly bool) (*release, error)
|
||||
}
|
||||
|
||||
func (p *publisher) doRelease(whatsNewUrl string, releaseNotesUrl string, nightly bool) error {
|
||||
currentRelease, err := p.builder.prepareRelease(p.baseArchiveUrl, whatsNewUrl, releaseNotesUrl, nightly)
|
||||
func (p *publisher) doRelease(whatsNewURL string, releaseNotesURL string, nightly bool) error {
|
||||
currentRelease, err := p.builder.prepareRelease(p.baseArchiveURL, whatsNewURL, releaseNotesURL, nightly)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -88,7 +89,7 @@ type buildArtifact struct {
|
||||
urlPostfix string
|
||||
}
|
||||
|
||||
func (t buildArtifact) getUrl(baseArchiveUrl, version string, releaseType ReleaseType) string {
|
||||
func (t buildArtifact) getURL(baseArchiveURL, version string, releaseType ReleaseType) string {
|
||||
prefix := "-"
|
||||
rhelReleaseExtra := ""
|
||||
|
||||
@ -100,7 +101,7 @@ func (t buildArtifact) getUrl(baseArchiveUrl, version string, releaseType Releas
|
||||
rhelReleaseExtra = "-1"
|
||||
}
|
||||
|
||||
url := strings.Join([]string{baseArchiveUrl, prefix, version, rhelReleaseExtra, t.urlPostfix}, "")
|
||||
url := strings.Join([]string{baseArchiveURL, prefix, version, rhelReleaseExtra, t.urlPostfix}, "")
|
||||
return url
|
||||
}
|
||||
|
||||
@ -187,16 +188,16 @@ func filterBuildArtifacts(filters []artifactFilter) ([]buildArtifact, error) {
|
||||
return artifacts, nil
|
||||
}
|
||||
|
||||
func newBuild(baseArchiveUrl string, ba buildArtifact, version string, rt ReleaseType, sha256 string) build {
|
||||
func newBuild(baseArchiveURL string, ba buildArtifact, version string, rt ReleaseType, sha256 string) build {
|
||||
return build{
|
||||
Os: ba.os,
|
||||
Url: ba.getUrl(baseArchiveUrl, version, rt),
|
||||
URL: ba.getURL(baseArchiveURL, version, rt),
|
||||
Sha256: sha256,
|
||||
Arch: ba.arch,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *publisher) apiUrl(url string) string {
|
||||
func (p *publisher) apiURL(url string) string {
|
||||
return fmt.Sprintf("%s/%s%s", p.apiUri, p.product, url)
|
||||
}
|
||||
|
||||
@ -207,12 +208,12 @@ func (p *publisher) postRequest(url string, obj interface{}, desc string) error
|
||||
}
|
||||
|
||||
if p.dryRun {
|
||||
log.Println(fmt.Sprintf("POST to %s:", p.apiUrl(url)))
|
||||
log.Println(fmt.Sprintf("POST to %s:", p.apiURL(url)))
|
||||
log.Println(string(jsonBytes))
|
||||
return nil
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(http.MethodPost, p.apiUrl(url), bytes.NewReader(jsonBytes))
|
||||
req, err := http.NewRequest(http.MethodPost, p.apiURL(url), bytes.NewReader(jsonBytes))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -254,14 +255,14 @@ type release struct {
|
||||
Stable bool `json:"stable"`
|
||||
Beta bool `json:"beta"`
|
||||
Nightly bool `json:"nightly"`
|
||||
WhatsNewUrl string `json:"whatsNewUrl"`
|
||||
ReleaseNotesUrl string `json:"releaseNotesUrl"`
|
||||
WhatsNewURL string `json:"whatsNewUrl"`
|
||||
ReleaseNotesURL string `json:"releaseNotesUrl"`
|
||||
Builds []build `json:"-"`
|
||||
}
|
||||
|
||||
type build struct {
|
||||
Os string `json:"os"`
|
||||
Url string `json:"url"`
|
||||
URL string `json:"url"`
|
||||
Sha256 string `json:"sha256"`
|
||||
Arch string `json:"arch"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user