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

yhu 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 3b76f4ab6ed Run Playground precommit checks in CI, check gofmt, 
reformat Go code (#25733)
3b76f4ab6ed is described below

commit 3b76f4ab6ed2f5b6a4f99d051fe064087b296242
Author: Timur Sultanov <[email protected]>
AuthorDate: Tue Mar 7 20:37:06 2023 +0400

    Run Playground precommit checks in CI, check gofmt, reformat Go code 
(#25733)
    
    * Update goloangci-lint version
    
    * Add gofmt check to precommit
    
    * Run Backend PreCommit checks in CI
    
    * Reformat Go code in Playground
    
    * Move precommit check to separate action
    
    * Add '--yes' to apt-get invokation
    
    * Use variables to set dependencies versions
---
 .github/workflows/playground_backend_precommit.yml | 68 ++++++++++++++++++++++
 playground/backend/build.gradle.kts                | 16 +++++
 playground/backend/cmd/server/http.go              |  2 +-
 playground/backend/cmd/server/wrapper.go           |  2 +-
 playground/backend/env_setup.sh                    |  2 +-
 playground/backend/internal/cache/cache.go         | 12 ++--
 .../internal/constants/datastore_constants.go      |  2 +-
 .../internal/constants/emulator_constants.go       |  2 +-
 .../backend/internal/db/datastore/datastore_db.go  | 10 ++--
 .../backend/internal/environment/property.go       |  2 +-
 playground/backend/internal/executors/executor.go  |  2 +-
 .../backend/internal/executors/executor_builder.go | 48 +++++++--------
 playground/backend/internal/logger/logger.go       |  5 +-
 .../backend/internal/preparers/go_preparers.go     |  8 +--
 .../backend/internal/preparers/java_preparers.go   | 18 +++---
 playground/backend/internal/preparers/preparer.go  |  6 +-
 .../backend/internal/preparers/preparer_test.go    |  2 +-
 .../backend/internal/preparers/python_preparers.go |  8 +--
 .../backend/internal/preparers/scio_preparers.go   | 10 ++--
 .../internal/streaming/run_output_writer.go        |  7 ++-
 .../backend/internal/tests/test_data/test_data.go  |  6 +-
 playground/backend/internal/utils/common.go        |  4 +-
 .../backend/internal/utils/preparers_utils.go      |  4 +-
 playground/backend/internal/utils/system_utils.go  |  4 +-
 .../backend/internal/validators/java_validators.go |  4 +-
 .../backend/internal/validators/scio_validators.go |  2 +-
 26 files changed, 174 insertions(+), 82 deletions(-)

diff --git a/.github/workflows/playground_backend_precommit.yml 
b/.github/workflows/playground_backend_precommit.yml
new file mode 100644
index 00000000000..6ea72fa5dbd
--- /dev/null
+++ b/.github/workflows/playground_backend_precommit.yml
@@ -0,0 +1,68 @@
+# 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.
+
+name: Playground PreCommit
+
+on:
+  workflow_dispatch:
+  pull_request:
+    paths:
+      - .github/workflows/playground_backend_precommit.yml
+      - playground/backend/**
+jobs:
+  precommit_check:
+    name: precommit-check
+    runs-on: ubuntu-latest
+    env:
+      DATASTORE_EMULATOR_VERSION: '389.0.0'
+      PYTHON_VERSION: '3.8'
+      JAVA_VERSION: '8'
+    steps:
+      - name: Check out the repo
+        uses: actions/checkout@v3
+
+      - uses: actions/setup-python@v4
+        with:
+          python-version: '${{ env.PYTHON_VERSION }}'
+      - uses: actions/[email protected]
+        with:
+          distribution: 'zulu'
+          java-version: '${{ env.JAVA_VERSION }}'
+
+      - name: Setup Gradle
+        uses: gradle/gradle-build-action@v2
+        with:
+          cache-read-only: false
+
+      - name: Add GOPATH/bin to PATH
+        run: echo "PATH=$PATH:$(go env GOPATH)/bin" >> $GITHUB_ENV
+
+      - name: Install sbt for running SCIO tests
+        run: |
+          sudo apt-get update --yes
+          sudo apt-get install apt-transport-https curl gnupg -yqq
+          echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | 
sudo tee /etc/apt/sources.list.d/sbt.list
+          echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee 
/etc/apt/sources.list.d/sbt_old.list
+          curl -sL 
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823";
 | sudo -H gpg --no-default-keyring --keyring 
gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
+          sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
+          sudo apt-get update --yes
+          sudo apt-get install sbt --yes
+      - name: Set up Cloud SDK and its components
+        uses: google-github-actions/setup-gcloud@v0
+        with:
+          install_components: 'beta,cloud-datastore-emulator'
+          version: '${{ env.DATASTORE_EMULATOR_VERSION }}'
+      - name: Run PreCommit
+        run: ./gradlew playground:backend:precommit
diff --git a/playground/backend/build.gradle.kts 
b/playground/backend/build.gradle.kts
index 124622b3a9e..47583ce2693 100644
--- a/playground/backend/build.gradle.kts
+++ b/playground/backend/build.gradle.kts
@@ -134,6 +134,21 @@ task("benchmark") {
   dependsOn(":playground:backend:benchmarkCodeProcessing")
 }
 
+task("checkFormat") {
+  doLast {
+    val stdout = java.io.ByteArrayOutputStream()
+
+    exec {
+      executable("gofmt")
+      args("-l", "-e", "-d", ".")
+      standardOutput = stdout
+    }
+    if (stdout.size() > 0) {
+      println(stdout.toString())
+      throw GradleException("gofmt check indicates that there are unformatted 
files")
+    }
+  }
+}
 
 task("installLinter") {
   doLast {
@@ -156,6 +171,7 @@ task("runLint") {
 
 task("precommit") {
   dependsOn(":playground:backend:runLint")
+  dependsOn(":playground:backend:checkFormat")
   dependsOn(":playground:backend:tidy")
   dependsOn(":playground:backend:test")
   dependsOn(":playground:backend:benchmark")
diff --git a/playground/backend/cmd/server/http.go 
b/playground/backend/cmd/server/http.go
index 46c3b05ae77..ab5555d863f 100644
--- a/playground/backend/cmd/server/http.go
+++ b/playground/backend/cmd/server/http.go
@@ -5,7 +5,7 @@
 // (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
+//     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,
diff --git a/playground/backend/cmd/server/wrapper.go 
b/playground/backend/cmd/server/wrapper.go
index 95bfd6235ca..2f7adba86ae 100644
--- a/playground/backend/cmd/server/wrapper.go
+++ b/playground/backend/cmd/server/wrapper.go
@@ -5,7 +5,7 @@
 // (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
+//     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,
diff --git a/playground/backend/env_setup.sh b/playground/backend/env_setup.sh
index 99b936c2e67..f01f1f4d153 100755
--- a/playground/backend/env_setup.sh
+++ b/playground/backend/env_setup.sh
@@ -14,7 +14,7 @@
 # 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.
-GO_LINTER_VERSION=1.48.0
+GO_LINTER_VERSION=1.51.2
 
 # Install GO Linter
 #wget 
https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-$GO_LINTER_VERSION-linux-amd64.deb
diff --git a/playground/backend/internal/cache/cache.go 
b/playground/backend/internal/cache/cache.go
index ea4b6161fcc..c3c1a70d72e 100644
--- a/playground/backend/internal/cache/cache.go
+++ b/playground/backend/internal/cache/cache.go
@@ -76,11 +76,15 @@ const (
 // Cache is used to store states and outputs for Apache Beam pipelines that 
running in Playground
 // Cache allows keep and read any value by pipelineId and subKey:
 // pipelineId_1:
-//                             subKey_1: value_1
-//                             subKey_2: value_2
+//
+//     subKey_1: value_1
+//     subKey_2: value_2
+//
 // pipelineId_2:
-//                             subKey_1: value_3
-//                             subKey_3: value_4
+//
+//     subKey_1: value_3
+//     subKey_3: value_4
+//
 // pipelineId is uuid that calculates in the controller when the server takes 
new request to run code
 type Cache interface {
        // GetValue returns value from cache by pipelineId and subKey.
diff --git a/playground/backend/internal/constants/datastore_constants.go 
b/playground/backend/internal/constants/datastore_constants.go
index 037c704cfbd..042b9f62163 100644
--- a/playground/backend/internal/constants/datastore_constants.go
+++ b/playground/backend/internal/constants/datastore_constants.go
@@ -15,7 +15,7 @@
 
 package constants
 
-//Cloud Datastore constants
+// Cloud Datastore constants
 const (
        Namespace             = "Playground"
        DatastoreNamespaceKey = "DATASTORE_NAMESPACE"
diff --git a/playground/backend/internal/constants/emulator_constants.go 
b/playground/backend/internal/constants/emulator_constants.go
index feb13ace205..9eb169d2775 100644
--- a/playground/backend/internal/constants/emulator_constants.go
+++ b/playground/backend/internal/constants/emulator_constants.go
@@ -15,7 +15,7 @@
 
 package constants
 
-//Emulator constants
+// Emulator constants
 const (
        TopicNameKey       = "topic"
        BootstrapServerKey = "bootstrapServer"
diff --git a/playground/backend/internal/db/datastore/datastore_db.go 
b/playground/backend/internal/db/datastore/datastore_db.go
index 5d6df2514b1..e11a868a8e6 100644
--- a/playground/backend/internal/db/datastore/datastore_db.go
+++ b/playground/backend/internal/db/datastore/datastore_db.go
@@ -165,7 +165,7 @@ func (d *Datastore) PutSDKs(ctx context.Context, sdks 
[]*entity.SDKEntity) error
        return nil
 }
 
-//GetFiles returns the file entities by a snippet identifier
+// GetFiles returns the file entities by a snippet identifier
 func (d *Datastore) GetFiles(ctx context.Context, snipId string, numberOfFiles 
int) ([]*entity.FileEntity, error) {
        if numberOfFiles == 0 {
                logger.Errorf("The number of files must be more than zero")
@@ -190,7 +190,7 @@ func (d *Datastore) GetFiles(ctx context.Context, snipId 
string, numberOfFiles i
        return files, nil
 }
 
-//GetSDKs returns sdk entities by an identifier
+// GetSDKs returns sdk entities by an identifier
 func (d *Datastore) GetSDKs(ctx context.Context) ([]*entity.SDKEntity, error) {
        var sdkKeys []*datastore.Key
        for sdkName := range pb.Sdk_value {
@@ -209,7 +209,7 @@ func (d *Datastore) GetSDKs(ctx context.Context) 
([]*entity.SDKEntity, error) {
        return sdks, nil
 }
 
-//GetCatalog returns all examples
+// GetCatalog returns all examples
 func (d *Datastore) GetCatalog(ctx context.Context, sdkCatalog 
[]*entity.SDKEntity) ([]*pb.Categories, error) {
        //Retrieving examples
        exampleQuery := 
datastore.NewQuery(constants.ExampleKind).Namespace(utils.GetNamespace(ctx)).FilterField("origin",
 "=", constants.ExampleOrigin)
@@ -270,7 +270,7 @@ func (d *Datastore) GetCatalog(ctx context.Context, 
sdkCatalog []*entity.SDKEnti
        }), nil
 }
 
-//GetDefaultExamples returns the default examples
+// GetDefaultExamples returns the default examples
 func (d *Datastore) GetDefaultExamples(ctx context.Context, sdks 
[]*entity.SDKEntity) (map[pb.Sdk]*pb.PrecompiledObject, error) {
        tx, err := d.Client.NewTransaction(ctx, datastore.ReadOnly)
        if err != nil {
@@ -502,7 +502,7 @@ func (d *Datastore) deleteSnippets(ctx context.Context, 
snippetQuery *datastore.
        return nil
 }
 
-//DeleteUnusedSnippets deletes all unused snippets
+// DeleteUnusedSnippets deletes all unused snippets
 func (d *Datastore) DeleteUnusedSnippets(ctx context.Context, dayDiff int32) 
error {
        var hoursDiff = dayDiff * 24
        boundaryDate := time.Now().Add(-time.Hour * time.Duration(hoursDiff))
diff --git a/playground/backend/internal/environment/property.go 
b/playground/backend/internal/environment/property.go
index b4a5407e199..8e9d034c097 100644
--- a/playground/backend/internal/environment/property.go
+++ b/playground/backend/internal/environment/property.go
@@ -24,7 +24,7 @@ const (
        configType = "yaml"
 )
 
-//Properties contains all properties that needed to run backend processes.
+// Properties contains all properties that needed to run backend processes.
 type Properties struct {
        // Salt is the salt to generate the hash to avoid whatever problems a 
collision may cause.
        Salt string `mapstructure:"playground_salt"`
diff --git a/playground/backend/internal/executors/executor.go 
b/playground/backend/internal/executors/executor.go
index 75e0fdcb5a6..4bba3b0d5eb 100644
--- a/playground/backend/internal/executors/executor.go
+++ b/playground/backend/internal/executors/executor.go
@@ -30,7 +30,7 @@ const (
        Test ExecutionType = "RunTest"
 )
 
-//CmdConfiguration for base cmd code execution
+// CmdConfiguration for base cmd code execution
 type CmdConfiguration struct {
        fileName        string
        workingDir      string
diff --git a/playground/backend/internal/executors/executor_builder.go 
b/playground/backend/internal/executors/executor_builder.go
index 7c4eb2f5784..c810f96e89c 100644
--- a/playground/backend/internal/executors/executor_builder.go
+++ b/playground/backend/internal/executors/executor_builder.go
@@ -22,37 +22,37 @@ import (
 
 type handler func(executor *Executor)
 
-//ExecutorBuilder struct
+// ExecutorBuilder struct
 type ExecutorBuilder struct {
        actions []handler
 }
 
-//CompileBuilder facet of ExecutorBuilder
+// CompileBuilder facet of ExecutorBuilder
 type CompileBuilder struct {
        ExecutorBuilder
 }
 
-//RunBuilder facet of ExecutorBuilder
+// RunBuilder facet of ExecutorBuilder
 type RunBuilder struct {
        ExecutorBuilder
 }
 
-//ValidatorBuilder facet of ExecutorBuilder
+// ValidatorBuilder facet of ExecutorBuilder
 type ValidatorBuilder struct {
        ExecutorBuilder
 }
 
-//PreparerBuilder facet of ExecutorBuilder
+// PreparerBuilder facet of ExecutorBuilder
 type PreparerBuilder struct {
        ExecutorBuilder
 }
 
-//UnitTestExecutorBuilder facet of ExecutorBuilder
+// UnitTestExecutorBuilder facet of ExecutorBuilder
 type UnitTestExecutorBuilder struct {
        ExecutorBuilder
 }
 
-//NewExecutorBuilder constructor for Executor
+// NewExecutorBuilder constructor for Executor
 func NewExecutorBuilder() *ExecutorBuilder {
        return &ExecutorBuilder{}
 }
@@ -82,7 +82,7 @@ func (b *ExecutorBuilder) WithTestRunner() 
*UnitTestExecutorBuilder {
        return &UnitTestExecutorBuilder{*b}
 }
 
-//WithCommand adds compile command to executor
+// WithCommand adds compile command to executor
 func (b *CompileBuilder) WithCommand(compileCmd string) *CompileBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.compileArgs.commandName = compileCmd
@@ -90,7 +90,7 @@ func (b *CompileBuilder) WithCommand(compileCmd string) 
*CompileBuilder {
        return b
 }
 
-//WithWorkingDir adds dir path to executor
+// WithWorkingDir adds dir path to executor
 func (b *CompileBuilder) WithWorkingDir(dir string) *CompileBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.compileArgs.workingDir = dir
@@ -98,7 +98,7 @@ func (b *CompileBuilder) WithWorkingDir(dir string) 
*CompileBuilder {
        return b
 }
 
-//WithArgs adds compile args to executor
+// WithArgs adds compile args to executor
 func (b *CompileBuilder) WithArgs(compileArgs []string) *CompileBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.compileArgs.commandArgs = compileArgs
@@ -106,7 +106,7 @@ func (b *CompileBuilder) WithArgs(compileArgs []string) 
*CompileBuilder {
        return b
 }
 
-//WithFileName adds file name to executor
+// WithFileName adds file name to executor
 func (b *CompileBuilder) WithFileName(fileName string) *CompileBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.compileArgs.fileName = fileName
@@ -114,7 +114,7 @@ func (b *CompileBuilder) WithFileName(fileName string) 
*CompileBuilder {
        return b
 }
 
-//WithExecutableFileName adds file name to executor
+// WithExecutableFileName adds file name to executor
 func (b *RunBuilder) WithExecutableFileName(name string) *RunBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.runArgs.fileName = name
@@ -122,7 +122,7 @@ func (b *RunBuilder) WithExecutableFileName(name string) 
*RunBuilder {
        return b
 }
 
-//WithWorkingDir adds dir path to executor
+// WithWorkingDir adds dir path to executor
 func (b *RunBuilder) WithWorkingDir(dir string) *RunBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.runArgs.workingDir = dir
@@ -130,7 +130,7 @@ func (b *RunBuilder) WithWorkingDir(dir string) *RunBuilder 
{
        return b
 }
 
-//WithCommand adds run command to executor
+// WithCommand adds run command to executor
 func (b *RunBuilder) WithCommand(runCmd string) *RunBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.runArgs.commandName = runCmd
@@ -138,7 +138,7 @@ func (b *RunBuilder) WithCommand(runCmd string) *RunBuilder 
{
        return b
 }
 
-//WithArgs adds run args to executor
+// WithArgs adds run args to executor
 func (b *RunBuilder) WithArgs(runArgs []string) *RunBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.runArgs.commandArgs = runArgs
@@ -146,7 +146,7 @@ func (b *RunBuilder) WithArgs(runArgs []string) *RunBuilder 
{
        return b
 }
 
-//WithGraphOutput adds the need of graph output to executor
+// WithGraphOutput adds the need of graph output to executor
 func (b *RunBuilder) WithGraphOutput() *RunBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                //todo
@@ -154,7 +154,7 @@ func (b *RunBuilder) WithGraphOutput() *RunBuilder {
        return b
 }
 
-//WithCommand adds test command to executor
+// WithCommand adds test command to executor
 func (b *UnitTestExecutorBuilder) WithCommand(testCmd string) 
*UnitTestExecutorBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.testArgs.commandName = testCmd
@@ -162,7 +162,7 @@ func (b *UnitTestExecutorBuilder) WithCommand(testCmd 
string) *UnitTestExecutorB
        return b
 }
 
-//WithArgs adds test args to executor
+// WithArgs adds test args to executor
 func (b *UnitTestExecutorBuilder) WithArgs(testArgs []string) 
*UnitTestExecutorBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.testArgs.commandArgs = testArgs
@@ -178,7 +178,7 @@ func (b *UnitTestExecutorBuilder) WithWorkingDir(dir 
string) *UnitTestExecutorBu
        return b
 }
 
-//WithGraphOutput adds the need of graph output to executor
+// WithGraphOutput adds the need of graph output to executor
 func (b *UnitTestExecutorBuilder) WithGraphOutput() *UnitTestExecutorBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                //todo
@@ -186,7 +186,7 @@ func (b *UnitTestExecutorBuilder) WithGraphOutput() 
*UnitTestExecutorBuilder {
        return b
 }
 
-//WithExecutableFileName adds file name to executor
+// WithExecutableFileName adds file name to executor
 func (b *UnitTestExecutorBuilder) WithExecutableFileName(name string) 
*UnitTestExecutorBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.testArgs.fileName = name
@@ -194,7 +194,7 @@ func (b *UnitTestExecutorBuilder) 
WithExecutableFileName(name string) *UnitTestE
        return b
 }
 
-//WithSdkValidators sets validators to executor
+// WithSdkValidators sets validators to executor
 func (b *ValidatorBuilder) WithSdkValidators(validators 
*[]validators.Validator) *ValidatorBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.validators = *validators
@@ -202,7 +202,7 @@ func (b *ValidatorBuilder) WithSdkValidators(validators 
*[]validators.Validator)
        return b
 }
 
-//WithSdkPreparers sets preparers to executor
+// WithSdkPreparers sets preparers to executor
 func (b *PreparerBuilder) WithSdkPreparers(preparers *[]preparers.Preparer) 
*PreparerBuilder {
        b.actions = append(b.actions, func(e *Executor) {
                e.preparers = *preparers
@@ -210,7 +210,7 @@ func (b *PreparerBuilder) WithSdkPreparers(preparers 
*[]preparers.Preparer) *Pre
        return b
 }
 
-//WithPipelineOptions adds pipeline options to executor
+// WithPipelineOptions adds pipeline options to executor
 func (b *RunBuilder) WithPipelineOptions(pipelineOptions []string) *RunBuilder 
{
        b.actions = append(b.actions, func(e *Executor) {
                e.runArgs.pipelineOptions = pipelineOptions
@@ -218,7 +218,7 @@ func (b *RunBuilder) WithPipelineOptions(pipelineOptions 
[]string) *RunBuilder {
        return b
 }
 
-//Build builds the executor object
+// Build builds the executor object
 func (b *ExecutorBuilder) Build() Executor {
        executor := Executor{}
        for _, a := range b.actions {
diff --git a/playground/backend/internal/logger/logger.go 
b/playground/backend/internal/logger/logger.go
index 0ffc574ae5e..d8ae69bc736 100644
--- a/playground/backend/internal/logger/logger.go
+++ b/playground/backend/internal/logger/logger.go
@@ -36,8 +36,9 @@ var handlers []Handler
 
 // SetupLogger constructs logger by application environment
 // Add handlers in root logger:
-//   CloudLoggingHandler - if server running on App Engine
-//   StdHandler - if server running locally
+//
+//     CloudLoggingHandler - if server running on App Engine
+//     StdHandler - if server running locally
 func SetupLogger(ctx context.Context, launchSite, googleProjectId string) {
        switch launchSite {
        case appEngine:
diff --git a/playground/backend/internal/preparers/go_preparers.go 
b/playground/backend/internal/preparers/go_preparers.go
index d76ac708eb4..e4607ceb65e 100644
--- a/playground/backend/internal/preparers/go_preparers.go
+++ b/playground/backend/internal/preparers/go_preparers.go
@@ -30,17 +30,17 @@ const (
        sep     = "."
 )
 
-//GoPreparersBuilder facet of PreparersBuilder
+// GoPreparersBuilder facet of PreparersBuilder
 type GoPreparersBuilder struct {
        PreparersBuilder
 }
 
-//GoPreparers chains to type *PreparersBuilder and returns a 
*GoPreparersBuilder
+// GoPreparers chains to type *PreparersBuilder and returns a 
*GoPreparersBuilder
 func (builder *PreparersBuilder) GoPreparers() *GoPreparersBuilder {
        return &GoPreparersBuilder{*builder}
 }
 
-//WithCodeFormatter adds code formatter preparer
+// WithCodeFormatter adds code formatter preparer
 func (builder *GoPreparersBuilder) WithCodeFormatter() *GoPreparersBuilder {
        formatCodePreparer := Preparer{
                Prepare: formatCode,
@@ -50,7 +50,7 @@ func (builder *GoPreparersBuilder) WithCodeFormatter() 
*GoPreparersBuilder {
        return builder
 }
 
-//WithFileNameChanger adds preparer to change file name
+// WithFileNameChanger adds preparer to change file name
 func (builder *GoPreparersBuilder) WithFileNameChanger() *GoPreparersBuilder {
        changeTestFileName := Preparer{
                Prepare: changeGoTestFileName,
diff --git a/playground/backend/internal/preparers/java_preparers.go 
b/playground/backend/internal/preparers/java_preparers.go
index ee824edcd50..e810274c189 100644
--- a/playground/backend/internal/preparers/java_preparers.go
+++ b/playground/backend/internal/preparers/java_preparers.go
@@ -47,17 +47,17 @@ const (
                "%s.run"
 )
 
-//JavaPreparersBuilder facet of PreparersBuilder
+// JavaPreparersBuilder facet of PreparersBuilder
 type JavaPreparersBuilder struct {
        PreparersBuilder
 }
 
-//JavaPreparers chains to type *PreparersBuilder and returns a 
*JavaPreparersBuilder
+// JavaPreparers chains to type *PreparersBuilder and returns a 
*JavaPreparersBuilder
 func (builder *PreparersBuilder) JavaPreparers() *JavaPreparersBuilder {
        return &JavaPreparersBuilder{*builder}
 }
 
-//WithPublicClassRemover adds preparer to remove public class
+// WithPublicClassRemover adds preparer to remove public class
 func (builder *JavaPreparersBuilder) WithPublicClassRemover() 
*JavaPreparersBuilder {
        removePublicClassPreparer := Preparer{
                Prepare: removePublicClassModifier,
@@ -67,7 +67,7 @@ func (builder *JavaPreparersBuilder) WithPublicClassRemover() 
*JavaPreparersBuil
        return builder
 }
 
-//WithPackageChanger adds preparer to change package
+// WithPackageChanger adds preparer to change package
 func (builder *JavaPreparersBuilder) WithPackageChanger() 
*JavaPreparersBuilder {
        changePackagePreparer := Preparer{
                Prepare: replace,
@@ -77,7 +77,7 @@ func (builder *JavaPreparersBuilder) WithPackageChanger() 
*JavaPreparersBuilder
        return builder
 }
 
-//WithPackageRemover adds preparer to remove package
+// WithPackageRemover adds preparer to remove package
 func (builder *JavaPreparersBuilder) WithPackageRemover() 
*JavaPreparersBuilder {
        removePackagePreparer := Preparer{
                Prepare: replace,
@@ -87,7 +87,7 @@ func (builder *JavaPreparersBuilder) WithPackageRemover() 
*JavaPreparersBuilder
        return builder
 }
 
-//WithFileNameChanger adds preparer to remove package
+// WithFileNameChanger adds preparer to remove package
 func (builder *JavaPreparersBuilder) WithFileNameChanger() 
*JavaPreparersBuilder {
        unitTestFileNameChanger := Preparer{
                Prepare: utils.ChangeTestFileName,
@@ -97,7 +97,7 @@ func (builder *JavaPreparersBuilder) WithFileNameChanger() 
*JavaPreparersBuilder
        return builder
 }
 
-//WithGraphHandler adds code to save the graph
+// WithGraphHandler adds code to save the graph
 func (builder *JavaPreparersBuilder) WithGraphHandler() *JavaPreparersBuilder {
        graphCodeAdder := Preparer{
                Prepare: addCodeToSaveGraph,
@@ -107,7 +107,7 @@ func (builder *JavaPreparersBuilder) WithGraphHandler() 
*JavaPreparersBuilder {
        return builder
 }
 
-//WithBootstrapServersChanger adds preparer to replace tokens in the example 
source to correct values
+// WithBootstrapServersChanger adds preparer to replace tokens in the example 
source to correct values
 func (builder *JavaPreparersBuilder) WithBootstrapServersChanger() 
*JavaPreparersBuilder {
        if len(builder.params) == 0 {
                return builder
@@ -124,7 +124,7 @@ func (builder *JavaPreparersBuilder) 
WithBootstrapServersChanger() *JavaPreparer
        return builder
 }
 
-//WithTopicNameChanger adds preparer to replace tokens in the example source 
to correct values
+// WithTopicNameChanger adds preparer to replace tokens in the example source 
to correct values
 func (builder *JavaPreparersBuilder) WithTopicNameChanger() 
*JavaPreparersBuilder {
        if len(builder.params) == 0 {
                return builder
diff --git a/playground/backend/internal/preparers/preparer.go 
b/playground/backend/internal/preparers/preparer.go
index e31131b0b88..0f103c75b1e 100644
--- a/playground/backend/internal/preparers/preparer.go
+++ b/playground/backend/internal/preparers/preparer.go
@@ -37,19 +37,19 @@ func (preparers *Preparers) GetPreparers() *[]Preparer {
        return preparers.functions
 }
 
-//PreparersBuilder struct
+// PreparersBuilder struct
 type PreparersBuilder struct {
        preparers *Preparers
        filePath  string
        params    map[string]string
 }
 
-//NewPreparersBuilder constructor for PreparersBuilder
+// NewPreparersBuilder constructor for PreparersBuilder
 func NewPreparersBuilder(filePath string, params map[string]string) 
*PreparersBuilder {
        return &PreparersBuilder{preparers: &Preparers{functions: 
&[]Preparer{}}, filePath: filePath, params: params}
 }
 
-//Build builds preparers from PreparersBuilder
+// Build builds preparers from PreparersBuilder
 func (builder *PreparersBuilder) Build() *Preparers {
        return builder.preparers
 }
diff --git a/playground/backend/internal/preparers/preparer_test.go 
b/playground/backend/internal/preparers/preparer_test.go
index d12960cb8b3..d2e1ac99038 100644
--- a/playground/backend/internal/preparers/preparer_test.go
+++ b/playground/backend/internal/preparers/preparer_test.go
@@ -54,7 +54,7 @@ func setupPreparedFiles() error {
        return nil
 }
 
-//createFile create file with fileName and write text to it
+// createFile create file with fileName and write text to it
 func createFile(fileName, text string) error {
        f, err := os.Create(fileName)
        if err != nil {
diff --git a/playground/backend/internal/preparers/python_preparers.go 
b/playground/backend/internal/preparers/python_preparers.go
index bb51d309e21..f050237492b 100644
--- a/playground/backend/internal/preparers/python_preparers.go
+++ b/playground/backend/internal/preparers/python_preparers.go
@@ -46,17 +46,17 @@ func GetPythonPreparers(builder *PreparersBuilder, 
isUnitTest bool) {
        }
 }
 
-//PythonPreparersBuilder facet of PreparersBuilder
+// PythonPreparersBuilder facet of PreparersBuilder
 type PythonPreparersBuilder struct {
        PreparersBuilder
 }
 
-//PythonPreparers chains to type *PreparersBuilder and returns a 
*GoPreparersBuilder
+// PythonPreparers chains to type *PreparersBuilder and returns a 
*GoPreparersBuilder
 func (builder *PreparersBuilder) PythonPreparers() *PythonPreparersBuilder {
        return &PythonPreparersBuilder{*builder}
 }
 
-//WithLogHandler adds code for logging
+// WithLogHandler adds code for logging
 func (builder *PythonPreparersBuilder) WithLogHandler() 
*PythonPreparersBuilder {
        addLogHandler := Preparer{
                Prepare: addCodeToFile,
@@ -66,7 +66,7 @@ func (builder *PythonPreparersBuilder) WithLogHandler() 
*PythonPreparersBuilder
        return builder
 }
 
-//WithGraphHandler adds code to save the graph
+// WithGraphHandler adds code to save the graph
 func (builder *PythonPreparersBuilder) WithGraphHandler() 
*PythonPreparersBuilder {
        addGraphHandler := Preparer{
                Prepare: addCodeToFile,
diff --git a/playground/backend/internal/preparers/scio_preparers.go 
b/playground/backend/internal/preparers/scio_preparers.go
index 82312d5e5c7..061cc6b98c7 100644
--- a/playground/backend/internal/preparers/scio_preparers.go
+++ b/playground/backend/internal/preparers/scio_preparers.go
@@ -24,17 +24,17 @@ const (
        emptyStr                   = ""
 )
 
-//ScioPreparersBuilder facet of PreparersBuilder
+// ScioPreparersBuilder facet of PreparersBuilder
 type ScioPreparersBuilder struct {
        PreparersBuilder
 }
 
-//ScioPreparers chains to type *PreparersBuilder and returns a 
*ScioPreparersBuilder
+// ScioPreparers chains to type *PreparersBuilder and returns a 
*ScioPreparersBuilder
 func (builder *PreparersBuilder) ScioPreparers() *ScioPreparersBuilder {
        return &ScioPreparersBuilder{*builder}
 }
 
-//WithFileNameChanger adds preparer to change source code file name
+// WithFileNameChanger adds preparer to change source code file name
 func (builder *ScioPreparersBuilder) WithFileNameChanger() 
*ScioPreparersBuilder {
        changeNamePreparer := Preparer{
                Prepare: utils.ChangeTestFileName,
@@ -44,7 +44,7 @@ func (builder *ScioPreparersBuilder) WithFileNameChanger() 
*ScioPreparersBuilder
        return builder
 }
 
-//WithPackageRemover adds preparer to remove package from the code
+// WithPackageRemover adds preparer to remove package from the code
 func (builder *ScioPreparersBuilder) WithPackageRemover() 
*ScioPreparersBuilder {
        removePackagePreparer := Preparer{
                Prepare: replace,
@@ -54,7 +54,7 @@ func (builder *ScioPreparersBuilder) WithPackageRemover() 
*ScioPreparersBuilder
        return builder
 }
 
-//WithImportRemover adds preparer to remove examples import from the code
+// WithImportRemover adds preparer to remove examples import from the code
 func (builder *ScioPreparersBuilder) WithImportRemover() *ScioPreparersBuilder 
{
        removeImportPreparer := Preparer{
                Prepare: replace,
diff --git a/playground/backend/internal/streaming/run_output_writer.go 
b/playground/backend/internal/streaming/run_output_writer.go
index 378e2b0ecc9..5dcfb0db4b7 100644
--- a/playground/backend/internal/streaming/run_output_writer.go
+++ b/playground/backend/internal/streaming/run_output_writer.go
@@ -35,9 +35,10 @@ type RunOutputWriter struct {
 //
 // As a result new bytes will be added to cache with old run output value.
 // Example:
-//     p = []byte(" with new run output")
-//     before Write(p): {pipelineId}:cache.RunOutput = "old run output"
-//     after Write(p): {pipelineId}:cache.RunOutput = "old run output with new 
run output"
+//
+//     p = []byte(" with new run output")
+//     before Write(p): {pipelineId}:cache.RunOutput = "old run output"
+//     after Write(p): {pipelineId}:cache.RunOutput = "old run output with new 
run output"
 func (row *RunOutputWriter) Write(p []byte) (int, error) {
        if len(p) == 0 {
                return 0, nil
diff --git a/playground/backend/internal/tests/test_data/test_data.go 
b/playground/backend/internal/tests/test_data/test_data.go
index 9e043016ed2..788677aab70 100644
--- a/playground/backend/internal/tests/test_data/test_data.go
+++ b/playground/backend/internal/tests/test_data/test_data.go
@@ -14,9 +14,9 @@
 // limitations under the License.
 
 /*
-       This is a golang script to download the example catalog and the sdk 
catalog
-       to the Cloud Datastore for local deployment and testing.
-       Please be aware that this is fictitious data.
+This is a golang script to download the example catalog and the sdk catalog
+to the Cloud Datastore for local deployment and testing.
+Please be aware that this is fictitious data.
 */
 package test_data
 
diff --git a/playground/backend/internal/utils/common.go 
b/playground/backend/internal/utils/common.go
index 234be276931..7af60cba6f6 100644
--- a/playground/backend/internal/utils/common.go
+++ b/playground/backend/internal/utils/common.go
@@ -28,7 +28,7 @@ func ReduceWhiteSpacesToSinge(s string) string {
        return re.ReplaceAllString(s, " ")
 }
 
-//ReadFile reads from file and returns string.
+// ReadFile reads from file and returns string.
 func ReadFile(pipelineId uuid.UUID, path string) (string, error) {
        content, err := ioutil.ReadFile(path)
        if err != nil {
@@ -38,7 +38,7 @@ func ReadFile(pipelineId uuid.UUID, path string) (string, 
error) {
        return string(content), nil
 }
 
-//ReadYamlFile reads from a yaml file.
+// ReadYamlFile reads from a yaml file.
 func ReadYamlFile(filename string, out interface{}) error {
        buf, err := ioutil.ReadFile(filename)
        if err != nil {
diff --git a/playground/backend/internal/utils/preparers_utils.go 
b/playground/backend/internal/utils/preparers_utils.go
index 50328551f18..7f9867d6f63 100644
--- a/playground/backend/internal/utils/preparers_utils.go
+++ b/playground/backend/internal/utils/preparers_utils.go
@@ -82,7 +82,7 @@ func ProcessLine(curLine string, pipelineName *string, spaces 
*string, regs *[]*
        return done, definitionType, err
 }
 
-//getVarName looking for a declaration of a beam pipeline and it's name
+// getVarName looking for a declaration of a beam pipeline and it's name
 func getVarName(line, spaces, pipelineName *string, regs *[]*regexp.Regexp) 
PipelineDefinitionType {
        for i, reg := range *regs {
                found := (*reg).FindAllStringSubmatch(*line, -1)
@@ -96,7 +96,7 @@ func getVarName(line, spaces, pipelineName *string, regs 
*[]*regexp.Regexp) Pipe
        return 0
 }
 
-//addGraphCode adds line for the graph saving to specific place in the code
+// addGraphCode adds line for the graph saving to specific place in the code
 func addGraphCode(line, spaces, pipelineName *string, regs *[]*regexp.Regexp) 
PipelineDefinitionType {
        for i, reg := range *regs {
                found := (*reg).FindAllStringSubmatch(*line, -1)
diff --git a/playground/backend/internal/utils/system_utils.go 
b/playground/backend/internal/utils/system_utils.go
index 51628fec1c8..acc2ca29fb2 100644
--- a/playground/backend/internal/utils/system_utils.go
+++ b/playground/backend/internal/utils/system_utils.go
@@ -56,7 +56,9 @@ func GetReadinessFunction(envs *environment.Environment) 
func(writer http.Respon
 }
 
 // checkNumOfTheParallelJobs checks the number of currently working code 
executions.
-//  It counts by the number of the 
/path/to/workingDir/executableFiles/{pipelineId} folders.
+//
+//     It counts by the number of the 
/path/to/workingDir/executableFiles/{pipelineId} folders.
+//
 // If it is equals or more than numOfParallelJobs, then returns false.
 // If it is less than numOfParallelJobs, then returns true.
 func checkNumOfTheParallelJobs(workingDir string, numOfParallelJobs int) bool {
diff --git a/playground/backend/internal/validators/java_validators.go 
b/playground/backend/internal/validators/java_validators.go
index 14b581009fb..9990ef223a8 100644
--- a/playground/backend/internal/validators/java_validators.go
+++ b/playground/backend/internal/validators/java_validators.go
@@ -53,7 +53,7 @@ func GetJavaValidators(filePath string) *[]Validator {
        return &validators
 }
 
-//checkIsUnitTestJava checks if the pipeline is a UnitTest
+// checkIsUnitTestJava checks if the pipeline is a UnitTest
 func checkIsUnitTestJava(args ...interface{}) (bool, error) {
        ok, err := checkPipelineType(append(args, javaUnitTestPattern)...)
        if err != nil {
@@ -62,7 +62,7 @@ func checkIsUnitTestJava(args ...interface{}) (bool, error) {
        return ok, nil
 }
 
-//checkIsKataJava checks if the pipeline is a kata
+// checkIsKataJava checks if the pipeline is a kata
 func checkIsKataJava(args ...interface{}) (bool, error) {
        ok, err := checkPipelineType(append(args, javaKatasPattern)...)
        if err != nil {
diff --git a/playground/backend/internal/validators/scio_validators.go 
b/playground/backend/internal/validators/scio_validators.go
index d43dfe1eba5..b169e5f1ddd 100644
--- a/playground/backend/internal/validators/scio_validators.go
+++ b/playground/backend/internal/validators/scio_validators.go
@@ -43,7 +43,7 @@ func GetScioValidators(filePath string) *[]Validator {
        return &validators
 }
 
-//checkIsUnitTestScio checks if the pipeline is a UnitTest
+// checkIsUnitTestScio checks if the pipeline is a UnitTest
 func checkIsUnitTestScio(args ...interface{}) (bool, error) {
        return false, nil
        //TODO BEAM-13702


Reply via email to