Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # tag=v9.2.0
with:
version: v2.7.2
version: v2.8.0
args: --output.text.print-linter-name=true --output.text.colors=true --timeout 10m
working-directory: ${{matrix.working-directory}}
6 changes: 3 additions & 3 deletions pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
obtainedStructuredPodList := corev1.PodList{}
Expect(informer.List(ctx, &obtainedStructuredPodList)).To(Succeed())
Expect(obtainedStructuredPodList.Items).Should(WithTransform(func(pods []corev1.Pod) []string {
obtainedPodNames := []string{}
obtainedPodNames := make([]string, 0, len(pods))
for _, pod := range pods {
obtainedPodNames = append(obtainedPodNames, pod.Name)
}
Expand All @@ -1615,7 +1615,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
err = informer.List(ctx, &obtainedUnstructuredPodList)
Expect(err).To(Succeed())
Expect(obtainedUnstructuredPodList.Items).Should(WithTransform(func(pods []unstructured.Unstructured) []string {
obtainedPodNames := []string{}
obtainedPodNames := make([]string, 0, len(pods))
for _, pod := range pods {
obtainedPodNames = append(obtainedPodNames, pod.GetName())
}
Expand All @@ -1635,7 +1635,7 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
err = informer.List(ctx, &obtainedMetadataPodList)
Expect(err).To(Succeed())
Expect(obtainedMetadataPodList.Items).Should(WithTransform(func(pods []metav1.PartialObjectMetadata) []string {
obtainedPodNames := []string{}
obtainedPodNames := make([]string, 0, len(pods))
for _, pod := range pods {
obtainedPodNames = append(obtainedPodNames, pod.Name)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/apiutil/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ErrResourceDiscoveryFailed map[schema.GroupVersion]error

// Error implements the error interface.
func (e *ErrResourceDiscoveryFailed) Error() string {
subErrors := []string{}
subErrors := make([]string, 0, len(*e))
for k, v := range *e {
subErrors = append(subErrors, fmt.Sprintf("%s: %v", k, v))
}
Expand All @@ -43,7 +43,7 @@ func (e *ErrResourceDiscoveryFailed) Error() string {
}

func (e *ErrResourceDiscoveryFailed) Unwrap() []error {
subErrors := []error{}
subErrors := make([]error, 0, len(*e))
for gv, err := range *e {
if apierrors.IsNotFound(err) {
err = &meta.NoResourceMatchError{PartialResource: gv.WithResource("")}
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func setConfigs(tc testCase, dir string) {

// Set KUBECONFIG env value
if len(tc.kubeconfigEnv) > 0 {
kubeconfigEnvPaths := []string{}
kubeconfigEnvPaths := make([]string, 0, len(tc.kubeconfigEnv))
for _, k := range tc.kubeconfigEnv {
kubeconfigEnvPaths = append(kubeconfigEnvPaths, filepath.Join(dir, k))
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/envtest/binaries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ var _ = Describe("Test download binaries", func() {

dirEntries, err := os.ReadDir(versionDownloadDirectory)
Expect(err).ToNot(HaveOccurred())
var actualFiles []string
actualFiles := make([]string, 0, len(dirEntries))
for _, e := range dirEntries {
actualFiles = append(actualFiles, e.Name())
}
Expand All @@ -184,7 +184,7 @@ var _ = Describe("Test download binaries", func() {

dirEntries, err := os.ReadDir(versionDownloadDirectory)
Expect(err).ToNot(HaveOccurred())
var actualFiles []string
actualFiles := make([]string, 0, len(dirEntries))
for _, e := range dirEntries {
actualFiles = append(actualFiles, e.Name())
}
Expand All @@ -203,7 +203,7 @@ var _ = Describe("Test download binaries", func() {

dirEntries, err := os.ReadDir(versionDownloadDirectory)
Expect(err).ToNot(HaveOccurred())
var actualFiles []string
actualFiles := make([]string, 0, len(dirEntries))
for _, e := range dirEntries {
actualFiles = append(actualFiles, e.Name())
}
Expand Down
3 changes: 2 additions & 1 deletion tools/setup-envtest/workflows/workflows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ var _ = Describe("Workflows", func() {
remoteHTTPItems = makeContentsHTTP(remoteNamesHTTP)
// Also only keep the first 7 items.
// Get the first 7 archive names
var archiveNames []string
archiveNames := make([]string, 0, len(remoteHTTPItems.index.Releases))

for _, release := range remoteHTTPItems.index.Releases {
for archiveName := range release {
archiveNames = append(archiveNames, archiveName)
Expand Down