You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2023/05/15 21:44:30 UTC

[beam] branch master updated: resolve go lints (#26639)

This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 39f9a99d7b5 resolve go lints (#26639)
39f9a99d7b5 is described below

commit 39f9a99d7b5ec008fbbbd6fafdbd745418df8e80
Author: Ritesh Ghorse <ri...@gmail.com>
AuthorDate: Mon May 15 17:44:24 2023 -0400

    resolve go lints (#26639)
---
 sdks/go/pkg/beam/core/graph/fn.go                |  5 ++---
 sdks/go/pkg/beam/core/runtime/exec/timers.go     | 13 ++++++-------
 sdks/go/pkg/beam/core/runtime/harness/harness.go |  2 +-
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/sdks/go/pkg/beam/core/graph/fn.go b/sdks/go/pkg/beam/core/graph/fn.go
index 63098427238..e316645cd6a 100644
--- a/sdks/go/pkg/beam/core/graph/fn.go
+++ b/sdks/go/pkg/beam/core/graph/fn.go
@@ -1436,9 +1436,8 @@ func validateTimer(fn *DoFn, numIn mainInputs) error {
 				if timer, ok := timerKeys[timerFamilyID]; ok {
 					err := errors.Errorf("Duplicate timer key %v", timerFamilyID)
 					return errors.SetTopLevelMsgf(err, "Duplicate timer family ID %v used by struct fields %v and %v. Ensure that timer family IDs are unique per DoFn", timerFamilyID, timer, fieldNames[i])
-				} else {
-					timerKeys[timerFamilyID] = fieldNames[i]
 				}
+				timerKeys[timerFamilyID] = fieldNames[i]
 			}
 		}
 		if err := validateOnTimerFn(fn); err != nil {
@@ -1451,7 +1450,7 @@ func validateTimer(fn *DoFn, numIn mainInputs) error {
 				", Ensure that you are using the TimerProvider to set and clear the timers.", pt)
 		}
 		if err := validateOnTimerFn(fn); err == nil {
-			actualErr := errors.New("OnTimer function is defined for the DoFn but no TimerProvider defined in ProcessElement.")
+			actualErr := errors.New("OnTimer function is defined for the DoFn but no TimerProvider defined in ProcessElement")
 			return errors.SetTopLevelMsgf(actualErr, "OnTimer function is defined for the DoFn but no TimerProvider defined in ProcessElement."+
 				"Ensure that timers.Provider is defined in the ProcessElement and OnTimer methods of DoFn.")
 		}
diff --git a/sdks/go/pkg/beam/core/runtime/exec/timers.go b/sdks/go/pkg/beam/core/runtime/exec/timers.go
index 0bc3e3dec35..0303efc270c 100644
--- a/sdks/go/pkg/beam/core/runtime/exec/timers.go
+++ b/sdks/go/pkg/beam/core/runtime/exec/timers.go
@@ -85,14 +85,13 @@ type timerProvider struct {
 func (p *timerProvider) getWriter(family string) (io.Writer, error) {
 	if w, ok := p.writersByFamily[family]; ok {
 		return w, nil
-	} else {
-		w, err := p.tm.OpenTimerWrite(p.ctx, p.sID, family)
-		if err != nil {
-			return nil, err
-		}
-		p.writersByFamily[family] = w
-		return p.writersByFamily[family], nil
 	}
+	w, err := p.tm.OpenTimerWrite(p.ctx, p.sID, family)
+	if err != nil {
+		return nil, err
+	}
+	p.writersByFamily[family] = w
+	return p.writersByFamily[family], nil
 }
 
 // Set writes a new timer. This can be used to both Set as well as Clear the timer.
diff --git a/sdks/go/pkg/beam/core/runtime/harness/harness.go b/sdks/go/pkg/beam/core/runtime/harness/harness.go
index f1a8b94b87c..3f0e82c8265 100644
--- a/sdks/go/pkg/beam/core/runtime/harness/harness.go
+++ b/sdks/go/pkg/beam/core/runtime/harness/harness.go
@@ -51,7 +51,7 @@ type Options struct {
 	StatusEndpoint     string   // Endpoint for worker status reporting.
 }
 
-// MainWithOptions is the main entrypoint for the Go harness. It runs at "runtime" -- not
+// Main is the main entrypoint for the Go harness. It runs at "runtime" -- not
 // "pipeline-construction time" -- on each worker. It is a FnAPI client and
 // ultimately responsible for correctly executing user code.
 //