lostluck commented on code in PR #16658:
URL: https://github.com/apache/beam/pull/16658#discussion_r1016987138


##########
sdks/python/container/boot.go:
##########
@@ -76,10 +77,8 @@ func main() {
        flag.Parse()
 
        if *setupOnly {
-               if err := processArtifactsInSetupOnlyMode(); err != nil {
-                       log.Fatalf("Setup unsuccessful with error: %v", err)
-               }
-               return
+               processArtifactsInSetupOnlyMode()
+               os.Exit(0)

Review Comment:
   Given the implementation of processArtifactsInSetupOnlyMode() this is a good 
cleanup/simplification. That function didn't need to return an error if it was 
simply failing out all the time.



##########
sdks/python/container/boot.go:
##########
@@ -137,46 +145,49 @@ func main() {
 
        options, err := provision.ProtoToJSON(info.GetPipelineOptions())
        if err != nil {
-               log.Fatalf("Failed to convert pipeline options: %v", err)
+               return fmt.Errorf("Failed to convert pipeline options: %v", err)
        }
 
        // (2) Retrieve and install the staged packages.
        //
-       // Guard from concurrent artifact retrieval and installation,
-       // when called by child processes in a worker pool.
+       // No log.Fatalf() from here on, otherwise deferred cleanups will not 
be called!

Review Comment:
   I also suggested splitting them into multiple functions, which would avoid 
that issue.
   
   It's not prescribed in Go to "only have a single return" or "only have a 
single way to exit". You're also allowed to do so if you like.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to