-
Notifications
You must be signed in to change notification settings - Fork 133
Description
The function GetTagNameFromUser() in pkg/prompt/prompt.go maybe contains a critical bug that causes the program to deadlock (hang forever) when called.
The current implementation creates an unbuffered channel but the goroutine is completely empty, meaning no value is ever sent to the channel. This causes the function to block indefinitely when it attempts to receive from the channel.
func GetTagNameFromUser() string {
repoName := make(chan string)
go func() {
// Empty - nothing sends to the channel
}()
return <-repoName // Blocks forever - DEADLOCK
}
Expected Behavior
The function should prompt the user to select a tag name, similar to other prompt functions in the same file.
Similar Working Pattern
For reference, here's a correctly implemented function in the same file:
func GetScannerIdFromUser() string {
scannerId := make(chan string)
go func() {
response, _ := api.ListScanners()
sview.ScannerList(response.Payload, scannerId) // Sends to channel
}()
return <-scannerId
}
Suggested Fix
Implement the function body to actually fetch tags and present them to the user:
func GetTagNameFromUser() string {
tagName := make(chan string)
go func() {
// TODO: Implement tag selection logic
// This needs additional parameters (project, repo, reference)
// to fetch tags from the API
}()
return <-tagName
}
Note: This function may need to be redesigned to accept parameters (project name, repository name, reference) or be removed if it's redundant with the existing GetTagFromUser() function which already handles tag selection properly.