From 7e8c2d300fd0d6f3374615a6eba2c1a5fa8c9259 Mon Sep 17 00:00:00 2001 From: adshmh Date: Tue, 27 Mar 2018 16:06:04 -0400 Subject: [PATCH] Fix several golint warnings (#3756) * fix(helm): fix golint warning due to ApiVersionV1 constant name Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to ResolveChartVersionAndGetRepo comment Signed-off-by: Arash Deshmeh * fix(helm): fix golint warnings on HttpGetter type and SetCredentials method missing a comment Signed-off-by: Arash Deshmeh * fix(helm):fix golint warning due to comment on FindChartInAuthRepoURL function Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to RepoFile type name Signed-off-by: Arash Deshmeh * fix(helm): fix golint warning due to ParseString comment Signed-off-by: Arash Deshmeh --- pkg/chartutil/chartfile.go | 2 +- pkg/downloader/chart_downloader.go | 2 +- pkg/getter/httpgetter.go | 6 ++++-- pkg/repo/chartrepo.go | 6 +++--- pkg/repo/repo.go | 3 ++- pkg/strvals/parser.go | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index 9897d66ff..c2879cdae 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -31,7 +31,7 @@ import ( // ApiVersionV1 is the API version number for version 1. // // This is ApiVersionV1 instead of APIVersionV1 to match the protobuf-generated name. -const ApiVersionV1 = "v1" +const ApiVersionV1 = "v1" // nolint // UnmarshalChartfile takes raw Chart.yaml data and unmarshals it. func UnmarshalChartfile(data []byte) (*chart.Metadata, error) { diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 9fe89820e..9262ea547 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -151,7 +151,7 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge return u, nil, err } -// Same as the ResolveChartVersion method, but returns the chart repositoryy. +// ResolveChartVersionAndGetRepo is the same as the ResolveChartVersion method, but returns the chart repositoryy. func (c *ChartDownloader) ResolveChartVersionAndGetRepo(ref, version string) (*url.URL, *repo.ChartRepository, *getter.HttpGetter, error) { u, err := url.Parse(ref) if err != nil { diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index dd462ce5f..3c20e35e1 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -27,13 +27,15 @@ import ( "k8s.io/helm/pkg/version" ) -//httpGetter is the efault HTTP(/S) backend handler -type HttpGetter struct { +//HttpGetter is the efault HTTP(/S) backend handler +// TODO: change the name to HTTPGetter in Helm 3 +type HttpGetter struct { //nolint client *http.Client username string password string } +//SetCredentials sets the credentials for the getter func (g *HttpGetter) SetCredentials(username, password string) { g.username = username g.password = password diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index c76cc7913..bf03a68bb 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -196,9 +196,9 @@ func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caF return FindChartInAuthRepoURL(repoURL, "", "", chartName, chartVersion, certFile, keyFile, caFile, getters) } -// FindChartInRepoURL finds chart in chart repository pointed by repoURL -// without adding repo to repositories. -// Unlike the FindChartInRepoURL function, this function also receives credentials for the chart repository. +// FindChartInAuthRepoURL finds chart in chart repository pointed by repoURL +// without adding repo to repositories, like FindChartInRepoURL, +// but it also receives credentials for the chart repository. func FindChartInAuthRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error) { // Download and write the index file to a temporary location diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index 194eace79..b5bba164e 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -31,7 +31,8 @@ import ( var ErrRepoOutOfDate = errors.New("repository file is out of date") // RepoFile represents the repositories.yaml file in $HELM_HOME -type RepoFile struct { +// TODO: change type name to File in Helm 3 to resolve linter warning +type RepoFile struct { // nolint APIVersion string `json:"apiVersion"` Generated time.Time `json:"generated"` Repositories []*Entry `json:"repositories"` diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 8a999feb7..8a16adf7e 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -50,7 +50,7 @@ func Parse(s string) (map[string]interface{}, error) { return vals, err } -// Parse parses a set line and forces a string value. +// ParseString parses a set line and forces a string value. // // A set line is of the form name1=value1,name2=value2 func ParseString(s string) (map[string]interface{}, error) {