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 2021/06/25 00:10:56 UTC

[GitHub] [beam] damondouglas commented on a change in pull request #15057: [BEAM-12513] Update initial sections of BPG for Go

damondouglas commented on a change in pull request #15057:
URL: https://github.com/apache/beam/pull/15057#discussion_r658365765



##########
File path: sdks/go/examples/snippets/01_03intro.go
##########
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package snippets
+
+import (
+	"flag"
+
+	"github.com/apache/beam/sdks/go/pkg/beam"
+	"github.com/apache/beam/sdks/go/pkg/beam/io/textio"
+)
+
+// PipelineConstruction contains snippets for the initial sections of
+// the Beam Programming Guide, from initializing to submitting a
+// pipeline.
+func PipelineConstruction() {
+	// [START pipeline_options]
+	// If beamx or Go flags are used, flags must be parsed first,
+	// before beam.Init() is called.
+	flag.Parse()
+	// [END pipeline_options]
+
+	// [START pipelines_constructing_creating]
+	// beam.Init() is an initialization hook that must be called near
+	// the beginging of main().

Review comment:
       I've been reading this remembering what it was like to start beam for the first time.  I thought perhaps this suggested change might be more explicit.
   
   Suggested change:
   
   ```
   // beam.Init() is an initialization hook that must be called near
   // the beginning of main().
   ```
   
   to
   
   ```
   // beam.Init() is an initialization hook that must be called inside the main() method
   // before calling NewPipeline or NewPipelineWithRoot
   ```




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