ajayd-san / gomanagedocker

TUI tool to manage your docker images, containers and volumes 🚀
MIT License
511 stars 23 forks source link

BUG 🐞: Crash on launch #18

Closed sammcj closed 3 months ago

sammcj commented 3 months ago

Describe the bug

The application crashes upon launch:

panic: runtime error: slice bounds out of range [:1] with capacity 0────────────────────────────────────────────────────────────────────────────────────────────────────┘

                                                                    goroutine 13 [running]:
                                                                                           github.com/ajayd-san/gomanagedocker/tui.transformListNames({0xfe5320, 0x0, 0x0})
                                                                                                                                                                            /root/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/ajayd-san/gomanagedocker@v1.1.2-0.20240717212957-c2b21f4eb981/tui/types.go:241 +0x2df
                                                                                                                                          github.com/ajayd-san/gomanagedocker/tui.imageItem.getName(...)
                            /root/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/ajayd-san/gomanagedocker@v1.1.2-0.20240717212957-c2b21f4eb981/tui/types.go:76
                                                                                                                                                                   github.com/ajayd-san/gomanagedocker/tui.MainModel.fetchNewData.func1()
                                                                /root/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/ajayd-san/gomanagedocker@v1.1.2-0.20240717212957-c2b21f4eb981/tui/mainModel.go:730 +0x11f
                                  created by github.com/ajayd-san/gomanagedocker/tui.MainModel.fetchNewData in goroutine 1
                                                                                                                            /root/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/ajayd-san/gomanagedocker@v1.1.2-0.20240717212957-c2b21f4eb981/tui/mainModel.go:724 +0x345
                                                                                                  #

The crash also left the terminal in a very borked state, I had a similar issue with my gollama application and I think the fix was to add a fmt.Print("\033[H\033[2J") upon exit to reset the term 😅

To Reproduce Steps to reproduce the behaviour:

This I'm not sure about actually but my specs below.

go install github.com/ajayd-san/gomanagedocker@HEAD
gomanagedocker

Expected behaviour

No crash to occur

Screenshots N/A

Server (please complete the following information):

Additional context Add any other context about the problem here.

ashishkhuraishy commented 3 months ago

this is beacuse of dangling images in local machine, had this same issue on my local - will create a pr for the fix

ajayd-san commented 3 months ago

@sammcj thanks for bringing to my notice. @ashishkhuraishy worked on a hotfix and it will be live soon!

ajayd-san commented 3 months ago

@sammcj I've pushed a hotfix to address this issue. Try installing from source again, You shouldn't have any issues.

@ashishkhuraishy thanks for your fix!

sammcj commented 3 months ago

That fixed it! Thanks to you both :)