Refactor binoculars internal library to eliminate os.Exit usage#4858
Open
itsfarhan wants to merge 1 commit intoarmadaproject:masterfrom
Open
Refactor binoculars internal library to eliminate os.Exit usage#4858itsfarhan wants to merge 1 commit intoarmadaproject:masterfrom
itsfarhan wants to merge 1 commit intoarmadaproject:masterfrom
Conversation
Signed-off-by: itsfarhan <itsmefarhan09@gmail.com>
Contributor
Greptile SummaryThis PR refactors Confidence Score: 5/5Safe to merge — straightforward refactoring with no behaviour change for callers. Both changed files are correct: the library now propagates errors instead of exiting, the main function handles them at the right boundary, and no existing tests break. All findings are at most P2. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant M as cmd/binoculars/main.go
participant S as internal/binoculars/server.go (StartUp)
participant K as cluster.NewKubernetesClientProvider
participant A as auth.ConfigureAuth
participant G as grpcCommon.Listen
M->>S: StartUp(&config)
S->>K: NewKubernetesClientProvider(...)
alt error
K-->>S: err
S-->>M: nil, nil, error
M->>M: log.Fatalf (process exits)
else success
K-->>S: kubernetesClientProvider
end
S->>A: ConfigureAuth(config.Auth)
alt error
A-->>S: err
S-->>M: nil, nil, error
M->>M: log.Fatalf (process exits)
else success
A-->>S: authServices
end
S->>G: Listen(config.GrpcPort, grpcServer, wg)
S-->>M: grpcServer.GracefulStop, wg, nil
M->>M: wg.Wait()
Reviews (1): Last reviewed commit: "refactored binoculars internal lib to re..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Refactoring internal library - binoculars
What this PR does / why we need it
Refactored the binoculars internal library to remove process terminating os.Exit calls, replacing them with returns as mentioned in the issue.
By changing the code to return an error, we give control back to cmd/binoculars/main.go (the main entry point). The main function will handle fatal errors and exit gracefully.
Which issue(s) this PR fixes
Fixes #4779
Special notes for your reviewer
Tested in local with these commands
Screenshot:
