From 1f85e6c6e3210ff9b3cf4746c75f7f13e230339a Mon Sep 17 00:00:00 2001 From: guoxudong Date: Fri, 10 Feb 2023 15:40:15 +0800 Subject: [PATCH] fix: solved the problem that the pod-lens crashes when the inoput is empty (#35) * fix: solved the problem that the pod-lens crashes when the inoput is empty --- .github/workflows/e2e.yaml | 7 ++++--- .goreleaser.yml | 13 +++++++++++++ pkg/plugin/plugin.go | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index a7ee1d0..d9030f6 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -50,12 +50,13 @@ jobs: kubectl get pods -n kube-system echo "current-context:" $(kubectl config current-context) - - name: Test kube-system + - name: Test Interactive run: | echo "********************************************************************************" - echo "Test kube-system..." + echo "Test Installation..." echo "********************************************************************************" - bin/pod-lens kube-apiserver-kind-control-plane -n kube-system + kubectl create deployment nginx --image=nginx + bin/pod-lens - name: Test Deployments run: | diff --git a/.goreleaser.yml b/.goreleaser.yml index 4bd8a4b..f8c5fe8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -27,3 +27,16 @@ archives: format_overrides: - goos: windows format: zip +# .goreleaser.yml +changelog: + use: github + abbrev: -1 + groups: + - title: Features + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 0 + - title: 'Bug fixes' + regexp: '^.*?bug(\([[:word:]]+\))??!?:.+$' + order: 1 + - title: Others + order: 999 diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index dc2d4fa..df65c10 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -81,7 +81,7 @@ func (sf *SnifferPlugin) findPodByName(name, namespace string) error { name + "], please check your parameters, set a context or verify API server.") } - if name[len(name)-1:] == "*" { + if len(name) != 0 && name[len(name)-1:] == "*" { name = name[:len(name)-1] }