LinuxSuRen / LinuxSuRen/http-downloader

panic: runtime error: invalid memory address or nil pointer dereference

Open
#241 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
48
Forks
16
PR merge metrics
No merged PRs in 30d

Description

hd version: v0.0.58

command:
```
hd install https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.4/kustomize_v4.5.4_linux_amd64.tar.gz
```

err log:
```
start to fetch the config
start to download from https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.5.4/kustomize_v4.5.4_linux_amd64.tar.gz
start to download with 4 threads, size: 4547228, unit: 1136807
Downloading part 1: [====================================================================] 100%
Downloading part 3: [====================================================================] 100%
Downloading part 2: [====================================================================] 100%
Downloading part 0: [====================================================================] 100%
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0xa04af4]

goroutine 1 [running]:
github.com/linuxsuren/http-downloader/cmd.(*installOption).install(0xc00009f900, 0xc000128f00, 0xc00011b530, 0x1, 0x1, 0xc00010e120, 0xc000107cd8)
/home/runner/work/http-downloader/http-downloader/cmd/install.go:164 +0x114
github.com/linuxsuren/http-downloader/cmd.(*installOption).runE(0xc00009f900, 0xc000128f00, 0xc00011b530, 0x1, 0x1, 0x0, 0x0)
/home/runner/work/http-downloader/http-downloader/cmd/install.go:225 +0x6f8
github.com/spf13/cobra.(*Command).execute(0xc000128f00, 0xc00011b500, 0x1, 0x1, 0xc000128f00, 0xc00011b500)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc000128a00, 0xc000022128, 0xc000128a00, 0xc00007e058)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
/home/runner/work/http-downloader/http-downloader/main.go:10 +0x47

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported kustomize install command, then inspect cmd/install.go at line 164 and the surrounding install flow shown in the stack trace. Confirm the cause of the nil pointer after all four downloads complete, and verify that the command finishes without the panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.