You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/05/14 00:05:14 UTC

[GitHub] [beam] lostluck commented on a change in pull request #11665: [BEAM-9951] Creating a synthetic source for the Go SDK.

lostluck commented on a change in pull request #11665:
URL: https://github.com/apache/beam/pull/11665#discussion_r424798718



##########
File path: sdks/go/examples/stringsplit/stringsplit.go
##########
@@ -112,15 +112,15 @@ func (fn *StringSplitFn) CreateTracker(rest offsetrange.Restriction) *offsetrang
 //
 // Example: If BufSize is 100, then a restriction of 75 to 325 should emit the
 // following substrings: [100, 200], [200, 300], [300, 400]
-func (fn *StringSplitFn) ProcessElement(rt *offsetrange.Tracker, elem string, emit func(string)) {
-	log.Debugf(context.Background(), "StringSplit ProcessElement: Tracker = %v", rt)
+func (fn *StringSplitFn) ProcessElement(ctx context.Context, rt *offsetrange.Tracker, elem string, emit func(string)) {
+	log.Debugf(ctx, "StringSplit ProcessElement: Tracker = %v", rt)
 	i := rt.Rest.Start
 	if rem := i % fn.BufSize; rem != 0 {
 		i += fn.BufSize - rem // Skip to next multiple of BufSize.
 	}
 	strEnd := int64(len(elem))
 
-	for ok := rt.TryClaim(i); ok == true; ok = rt.TryClaim(i) {
+	for rt.TryClaim(i) == true {

Review comment:
       It takes two. :P 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org