Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few small linting bugs #17695

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sdks/go/cmd/specialize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,17 @@ func genericTypingRepresentation(in int, out int, includeType bool) string {
func possibleBundleLifecycleParameterCombos(numInInterface interface{}, processElementInInterface interface{}) [][]string {
numIn := numInInterface.(int)
processElementIn := processElementInInterface.(int)
ordered_known_parameter_options := []string{"context.Context", "typex.PaneInfo", "[]typex.Window", "typex.EventTime", "typex.BundleFinalization"}
orderedKnownParameterOptions := []string{"context.Context", "typex.PaneInfo", "[]typex.Window", "typex.EventTime", "typex.BundleFinalization"}
// Because of how Bundle lifecycle functions are invoked, all known parameters must precede unknown options and be in order.
// Once we hit an unknown options, all remaining unknown options must be included since all iters/emitters must be included
// Therefore, we can generate a powerset of the known options and fill out any remaining parameters with an ordered set of remaining unknown options
pSetSize := int(math.Pow(2, float64(len(ordered_known_parameter_options))))
pSetSize := int(math.Pow(2, float64(len(orderedKnownParameterOptions))))
combos := make([][]string, 0, pSetSize)

for index := 0; index < pSetSize; index++ {
var subSet []string

for j, elem := range ordered_known_parameter_options {
for j, elem := range orderedKnownParameterOptions {
// And with the bit representation to get this iteration of the powerset.
if index&(1<<uint(j)) > 0 {
subSet = append(subSet, elem)
Expand Down
2 changes: 1 addition & 1 deletion sdks/go/pkg/beam/core/graph/coder/coder_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func FuzzEncodeDecodeDouble(f *testing.F) {

actual, err := DecodeDouble(&buf)
if err != nil {
t.Fatalf("DecodeDouble(%v) failed: %v", buf, err)
t.Fatalf("DecodeDouble(%v) failed: %v", &buf, err)
}
if math.Abs(actual-a) > floatPrecision {
t.Fatalf("got %f, want %f +/- %f", actual, a, floatPrecision)
Expand Down
2 changes: 1 addition & 1 deletion sdks/go/pkg/beam/core/graph/mtime/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func TestToTime(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
if got, want := test.input.ToTime(), test.expOut; got != want {
if got, want := test.input.ToTime(), test.expOut; !got.Equal(want) {
t.Errorf("ToTime(%v), got %v, want %v", test.input, got, want)
}
})
Expand Down
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/io/rtrackers/offsetrange/offsetrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ func (tracker *Tracker) GetRestriction() interface{} {
return tracker.rest
}

// IsBounded returns whether or not the restriction tracker is tracking a bounded restriction
// that has a set maximum value or an unbounded one which can grow indefinitely.
func (tracker *Tracker) IsBounded() bool {
return true
}
2 changes: 1 addition & 1 deletion sdks/go/pkg/beam/pardo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (fn *AnnotationsFn) ProcessElement(v int) int {
}

func doNothing(_ []byte, _ int) {}
func TestParDoSideInputValdiation(t *testing.T) {
func TestParDoSideInputValidation(t *testing.T) {
var tests = []struct {
name string
wFn *window.Fn
Expand Down
2 changes: 1 addition & 1 deletion sdks/go/test/integration/primitives/checkpointing.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (fn *selfCheckpointingDoFn) ProcessElement(rt *sdf.LockRTracker, _ []byte,
if rt.TryClaim(position) {
// Successful claim, emit the value and move on.
emit(position)
position += 1
position++
return sdf.ResumeProcessingIn(1 * time.Second)
} else if rt.GetError() != nil || rt.IsDone() {
// Stop processing on error or completion
Expand Down