Merge pull request #31873 from mmorel-35/perfsprint-pkg-5-3294250

chore(pkg): fix perfsprint linter issues part 5
pull/31955/head
George Jenkins 6 months ago committed by GitHub
commit 610547b570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -92,7 +92,7 @@ func (d *Dependency) dependencyStatus(chartpath string, dep *chart.Dependency, p
for _, arc := range archives { for _, arc := range archives {
// we need to trip the prefix dirs and the extension off. // we need to trip the prefix dirs and the extension off.
filename = strings.TrimSuffix(filepath.Base(arc), ".tgz") filename = strings.TrimSuffix(filepath.Base(arc), ".tgz")
maybeVersion := strings.TrimPrefix(filename, fmt.Sprintf("%s-", dep.Name)) maybeVersion := strings.TrimPrefix(filename, dep.Name+"-")
if _, err := semver.StrictNewVersion(maybeVersion); err == nil { if _, err := semver.StrictNewVersion(maybeVersion); err == nil {
// If the version parsed without an error, it is possibly a valid // If the version parsed without an error, it is possibly a valid

@ -17,6 +17,7 @@ limitations under the License.
package rules package rules
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
@ -47,7 +48,7 @@ func ValuesWithOverrides(linter *support.Linter, valueOverrides map[string]any,
func validateValuesFileExistence(valuesPath string) error { func validateValuesFileExistence(valuesPath string) error {
_, err := os.Stat(valuesPath) _, err := os.Stat(valuesPath)
if err != nil { if err != nil {
return fmt.Errorf("file does not exist") return errors.New("file does not exist")
} }
return nil return nil
} }

@ -24,7 +24,6 @@ These dependencies are expressed as interfaces so that alternate implementations
package cli package cli
import ( import (
"fmt"
"net/http" "net/http"
"os" "os"
"strconv" "strconv"
@ -246,7 +245,7 @@ func (s *EnvSettings) EnvVars() map[string]string {
"HELM_CACHE_HOME": helmpath.CachePath(""), "HELM_CACHE_HOME": helmpath.CachePath(""),
"HELM_CONFIG_HOME": helmpath.ConfigPath(""), "HELM_CONFIG_HOME": helmpath.ConfigPath(""),
"HELM_DATA_HOME": helmpath.DataPath(""), "HELM_DATA_HOME": helmpath.DataPath(""),
"HELM_DEBUG": fmt.Sprint(s.Debug), "HELM_DEBUG": strconv.FormatBool(s.Debug),
"HELM_PLUGINS": s.PluginsDirectory, "HELM_PLUGINS": s.PluginsDirectory,
"HELM_REGISTRY_CONFIG": s.RegistryConfig, "HELM_REGISTRY_CONFIG": s.RegistryConfig,
"HELM_REPOSITORY_CACHE": s.RepositoryCache, "HELM_REPOSITORY_CACHE": s.RepositoryCache,

@ -62,7 +62,7 @@ func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
var comps []string var comps []string
for _, p := range providers { for _, p := range providers {
for _, scheme := range p.Schemes { for _, scheme := range p.Schemes {
comps = append(comps, fmt.Sprintf("%s://", scheme)) comps = append(comps, scheme+"://")
} }
} }
return comps, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveNoSpace return comps, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveNoSpace

@ -58,7 +58,7 @@ func (g *OCIGetter) get(href string) (*bytes.Buffer, error) {
client = c client = c
} }
ref := strings.TrimPrefix(href, fmt.Sprintf("%s://", registry.OCIScheme)) ref := strings.TrimPrefix(href, registry.OCIScheme+"://")
if version := g.opts.version; version != "" && !strings.Contains(path.Base(ref), ":") { if version := g.opts.version; version != "" && !strings.Contains(path.Base(ref), ":") {
ref = fmt.Sprintf("%s:%s", ref, version) ref = fmt.Sprintf("%s:%s", ref, version)

@ -20,7 +20,6 @@ import (
"bytes" "bytes"
"context" "context"
"errors" "errors"
"fmt"
"io" "io"
"net/http" "net/http"
"strings" "strings"
@ -1434,7 +1433,7 @@ func TestIsIncompatibleServerError(t *testing.T) {
Want: false, Want: false,
}, },
"Generic error": { "Generic error": {
Err: fmt.Errorf("some generic error"), Err: errors.New("some generic error"),
Want: false, Want: false,
}, },
} }

@ -17,7 +17,6 @@ limitations under the License.
package fake package fake
import ( import (
"fmt"
"io" "io"
"strings" "strings"
"time" "time"
@ -133,7 +132,7 @@ func (p *PrintingKubeClient) GetPodList(_ string, _ metav1.ListOptions) (*v1.Pod
// OutputContainerLogsForPodList implements KubeClient OutputContainerLogsForPodList. // OutputContainerLogsForPodList implements KubeClient OutputContainerLogsForPodList.
func (p *PrintingKubeClient) OutputContainerLogsForPodList(_ *v1.PodList, someNamespace string, _ func(namespace, pod, container string) io.Writer) error { func (p *PrintingKubeClient) OutputContainerLogsForPodList(_ *v1.PodList, someNamespace string, _ func(namespace, pod, container string) io.Writer) error {
_, err := io.Copy(p.LogOutput, strings.NewReader(fmt.Sprintf("attempted to output logs for namespace: %s", someNamespace))) _, err := io.Copy(p.LogOutput, strings.NewReader("attempted to output logs for namespace: "+someNamespace))
return err return err
} }

@ -246,7 +246,7 @@ func (hw *legacyWaiter) watchUntilReady(timeout time.Duration, info *resource.In
// Use a selector on the name of the resource. This should be unique for the // Use a selector on the name of the resource. This should be unique for the
// given version and kind // given version and kind
selector, err := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", info.Name)) selector, err := fields.ParseSelector("metadata.name=" + info.Name)
if err != nil { if err != nil {
return err return err
} }

@ -18,6 +18,7 @@ package registry
import ( import (
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"strings" "strings"
@ -190,7 +191,7 @@ func GetPluginName(source string) (string, error) {
// e.g., "ghcr.io/user/plugin-name:v1.0.0" -> Repository: "user/plugin-name" // e.g., "ghcr.io/user/plugin-name:v1.0.0" -> Repository: "user/plugin-name"
repository := ref.Repository repository := ref.Repository
if repository == "" { if repository == "" {
return "", fmt.Errorf("invalid OCI reference: missing repository") return "", errors.New("invalid OCI reference: missing repository")
} }
// Get the last part of the repository path as the plugin name // Get the last part of the repository path as the plugin name

@ -17,7 +17,6 @@ limitations under the License.
package registry package registry
import ( import (
"fmt"
"strings" "strings"
"oras.land/oras-go/v2/registry" "oras.land/oras-go/v2/registry"
@ -80,5 +79,5 @@ func (r *reference) String() string {
// IsOCI determines whether a URL is to be treated as an OCI URL // IsOCI determines whether a URL is to be treated as an OCI URL
func IsOCI(url string) bool { func IsOCI(url string) bool {
return strings.HasPrefix(url, fmt.Sprintf("%s://", OCIScheme)) return strings.HasPrefix(url, OCIScheme+"://")
} }

Loading…
Cancel
Save