Skip to content
This repository has been archived by the owner on Jul 30, 2023. It is now read-only.

Panic: runtime error with Krew #64

Closed
a-mazed opened this issue May 4, 2021 · 3 comments
Closed

Panic: runtime error with Krew #64

a-mazed opened this issue May 4, 2021 · 3 comments

Comments

@a-mazed
Copy link

a-mazed commented May 4, 2021

Hi!
Thank you for such a good tool!

I found an panic error when use Krew:

k krew version
panic: runtime error: index out of range [1] with length 1

goroutine 18 [running]:
github.com/dty1er/kubecolor/printer.(*VersionPrinter).Print(0xc000014088, 0x5400c0, 0xc0000ac028, 0x5400e0, 0xc0000ac008)
        /home/runner/work/kubecolor/kubecolor/printer/kubectl_version.go:41 +0xd7a
github.com/dty1er/kubecolor/printer.(*KubectlOutputColoredPrinter).Print(0xc000094350, 0x5400c0, 0xc0000ac028, 0x5400e0, 0xc0000ac008)
        /home/runner/work/kubecolor/kubecolor/printer/kubectl_output_colored_printer.go:109 +0x15e
github.com/dty1er/kubecolor/command.Run.func1(0xc0000ba0c0, 0x5405e0, 0xc0000ac028, 0xc0000a8050)
        /home/runner/work/kubecolor/kubecolor/command/runner.go:89 +0x9b
created by github.com/dty1er/kubecolor/command.Run
        /home/runner/work/kubecolor/kubecolor/command/runner.go:88 +0x43d

It should be:

k krew version
OPTION            VALUE
GitTag            v0.4.0
GitCommit         8bebb56
IndexURI          https://github.com/kubernetes-sigs/krew-index.git

kubectl version

k version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.16-gke.2100", GitCommit:"36d0b0a39224fef7a40df3d2bc61dfd96c8c7f6a", GitTreeState:"clean", BuildDate:"2021-03-16T09:15:29Z", GoVersion:"go1.13.15b4", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.21) and server (1.18) exceeds the supported minor version skew of +/-1

Please check

@hidetatz
Copy link
Owner

hidetatz commented May 4, 2021

It reproduced. Will fix it soon, thank you for the report

@hidetatz
Copy link
Owner

hidetatz commented May 5, 2021

I fixed the crash by v0.0.19. Please update kubecolor and try again.

Because I wanted to avoid the panic quickly, so for now krew version is not colorized but I'll consider if I should do that.

Anyway thank you for opening the issue!

@a-mazed
Copy link
Author

a-mazed commented May 5, 2021

It works
Thank you

@hidetatz hidetatz closed this as completed May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants