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 2022/05/13 23:05:05 UTC
[beam] branch master updated: [BEAM-14371] (and BEAM-14372) - enable a couple staticchecks (#17670)
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 780ad62d42f [BEAM-14371] (and BEAM-14372) - enable a couple staticchecks (#17670)
780ad62d42f is described below
commit 780ad62d42f8216ba030e97c203fc2310cd041b0
Author: Danny McCormick <da...@google.com>
AuthorDate: Fri May 13 19:04:58 2022 -0400
[BEAM-14371] (and BEAM-14372) - enable a couple staticchecks (#17670)
---
sdks/go/pkg/beam/coder.go | 8 --------
sdks/go/pkg/beam/core/graph/fn_test.go | 2 ++
sdks/go/pkg/beam/core/runtime/exec/emit.go | 5 +++--
sdks/go/pkg/beam/core/runtime/genx/genx_test.go | 2 ++
sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go | 1 -
sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go | 2 ++
sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go | 2 ++
sdks/go/pkg/beam/core/runtime/graphx/translate.go | 6 ------
sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go | 6 ------
sdks/go/pkg/beam/core/runtime/types_test.go | 2 ++
sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go | 2 --
sdks/go/pkg/beam/staticcheck.conf | 4 +---
sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go | 3 +++
13 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/sdks/go/pkg/beam/coder.go b/sdks/go/pkg/beam/coder.go
index fe6be472853..a6e1441e8c0 100644
--- a/sdks/go/pkg/beam/coder.go
+++ b/sdks/go/pkg/beam/coder.go
@@ -374,11 +374,3 @@ func schemaDec(t reflect.Type, in []byte) (T, error) {
}
return val, nil
}
-
-func newSchemaCoder(t reflect.Type) (*coder.CustomCoder, error) {
- c, err := coder.NewCustomCoder("schema", t, schemaEnc, schemaDec)
- if err != nil {
- return nil, errors.Wrapf(err, "invalid coder")
- }
- return c, nil
-}
diff --git a/sdks/go/pkg/beam/core/graph/fn_test.go b/sdks/go/pkg/beam/core/graph/fn_test.go
index 5f0e274b084..9333db34734 100644
--- a/sdks/go/pkg/beam/core/graph/fn_test.go
+++ b/sdks/go/pkg/beam/core/graph/fn_test.go
@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused functions/types are for tests
+
package graph
import (
diff --git a/sdks/go/pkg/beam/core/runtime/exec/emit.go b/sdks/go/pkg/beam/core/runtime/exec/emit.go
index e24b6925ed7..c008b0b412d 100644
--- a/sdks/go/pkg/beam/core/runtime/exec/emit.go
+++ b/sdks/go/pkg/beam/core/runtime/exec/emit.go
@@ -35,8 +35,9 @@ type ReusableEmitter interface {
Value() interface{}
}
-// ReusableEmitter is a resettable value needed to hold the implicit context and
-// emit event time. It also has the ability to have a watermark estimator attached.
+// ReusableTimestampObservingWatermarkEmitter is a resettable value needed to hold
+// the implicit context and emit event time. It also has the ability to have a
+// watermark estimator attached.
type ReusableTimestampObservingWatermarkEmitter interface {
ReusableEmitter
AttachEstimator(est *sdf.WatermarkEstimator)
diff --git a/sdks/go/pkg/beam/core/runtime/genx/genx_test.go b/sdks/go/pkg/beam/core/runtime/genx/genx_test.go
index 24f96a5bc7a..17b69038157 100644
--- a/sdks/go/pkg/beam/core/runtime/genx/genx_test.go
+++ b/sdks/go/pkg/beam/core/runtime/genx/genx_test.go
@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused functions/types are for tests
+
package genx
import (
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go b/sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go
index 42bda4f79b6..cea0cbbf76e 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/schema/logicaltypes.go
@@ -124,7 +124,6 @@ type LogicalType struct {
identifier string
goT, storageT, argT reflect.Type
argV reflect.Value
- toStorage, toGo func(value reflect.Value) reflect.Value
}
// ID is a unique identifier for the logical type.
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go b/sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go
index ef66499de4e..5ef2f707280 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/schema/schema_test.go
@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused functions/types are for tests
+
package schema
import (
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go b/sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go
index b1a3369e768..cd0e6dda994 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/serialize_test.go
@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused functions/types are for tests
+
package graphx
import (
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/translate.go b/sdks/go/pkg/beam/core/runtime/graphx/translate.go
index b28820966a8..d5c7a31b3e4 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/translate.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/translate.go
@@ -1248,12 +1248,6 @@ func mustEncodeMultiEdgeBase64(edge *graph.MultiEdge) (string, error) {
}), nil
}
-// makeBytesKeyedCoder returns KV<[]byte,A,> for any coder,
-// even if the coder is already a KV coder.
-func makeBytesKeyedCoder(c *coder.Coder) *coder.Coder {
- return coder.NewKV([]*coder.Coder{coder.NewBytes(), c})
-}
-
func edgeID(edge *graph.MultiEdge) string {
return fmt.Sprintf("e%v", edge.ID())
}
diff --git a/sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go b/sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go
index a94fce634e6..7b68a770768 100644
--- a/sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go
+++ b/sdks/go/pkg/beam/core/runtime/graphx/xlang_test.go
@@ -145,12 +145,6 @@ func newComponents(ts []string) *pipepb.Components {
return components
}
-func expectPanic(t *testing.T, err string) {
- if r := recover(); r == nil {
- t.Errorf("expected panic; %v", err)
- }
-}
-
func TestExpandedTransform(t *testing.T) {
t.Run("Correct PTransform", func(t *testing.T) {
want := newTransform("x")
diff --git a/sdks/go/pkg/beam/core/runtime/types_test.go b/sdks/go/pkg/beam/core/runtime/types_test.go
index ed9b9e9606a..b301df6da14 100644
--- a/sdks/go/pkg/beam/core/runtime/types_test.go
+++ b/sdks/go/pkg/beam/core/runtime/types_test.go
@@ -13,6 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused functions/types are for tests
+
package runtime
import (
diff --git a/sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go b/sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go
index 6938c51c201..a027e00c5db 100644
--- a/sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go
+++ b/sdks/go/pkg/beam/io/xlang/jdbcio/jdbc.go
@@ -69,8 +69,6 @@ var defaultClasspaths = map[string][]string{
"com.mysql.jdbc.Driver": []string{"mysql:mysql-connector-java:8.0.28"},
}
-var autoStartupAddress string = xlangx.UseAutomatedJavaExpansionService(serviceGradleTarget)
-
// jdbcConfigSchema is the config schema as per the expected corss language payload
// for JDBC IO read and write transform.
type jdbcConfigSchema struct {
diff --git a/sdks/go/pkg/beam/staticcheck.conf b/sdks/go/pkg/beam/staticcheck.conf
index e4a182b22f4..5da9745a7a0 100644
--- a/sdks/go/pkg/beam/staticcheck.conf
+++ b/sdks/go/pkg/beam/staticcheck.conf
@@ -17,6 +17,4 @@
# analysis tool. See https://staticcheck.io/docs/checks/ for descriptions of
# each check.
-# TODO(BEAM-14371): Clean up instances of S1021 (merge variable declaration and assignment) and enable check
-# TODO(BEAM-14372): Clean up instances of U1000 (unused fields, vars, functions) and enable check
-checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023", "-SA1019", "-U1000", "-S1021"]
\ No newline at end of file
+checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1022", "-ST1023", "-SA1019", "-S1021"]
\ No newline at end of file
diff --git a/sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go b/sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go
index 7e537a4cbd9..2f050a14432 100644
--- a/sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go
+++ b/sdks/go/pkg/beam/transforms/sql/sqlx/sqlx.go
@@ -13,6 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//lint:file-ignore U1000 unused type options in ExpansionPayload struct is needed to maintain
+// correct expected serialized payload
+
// Package sqlx contains "internal" SQL transform interfaces that are needed
// by the SQL expansion providers.
//