Skip to content

Commit

Permalink
github: run go vet on push
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie committed Sep 10, 2024
1 parent 2b73c69 commit c770bfb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/gha-go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Run vet
run: make vet
- name: Run staticcheck
env:
SC_VERSION: "2024.1"
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHONY: vet
vet:
go vet ./...

.PHONY: static
static:
staticcheck ./...
Expand Down
47 changes: 24 additions & 23 deletions integration_tests/mongo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import (
"context"
"encoding/json"
"fmt"
"log/slog"
"math/rand/v2"
"os"
"reflect"
"time"

"github.com/artie-labs/reader/config"
"github.com/artie-labs/reader/integration_tests/utils"
"github.com/artie-labs/reader/lib"
Expand All @@ -16,11 +22,6 @@ import (
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"log/slog"
"math/rand/v2"
"os"
"reflect"
"time"
)

func main() {
Expand Down Expand Up @@ -96,25 +97,25 @@ func testTypes(ctx context.Context, db *mongo.Database, mongoCfg config.MongoDB)
ts := time.Date(2020, 10, 5, 12, 0, 0, 0, time.UTC)

_, err = collection.InsertOne(ctx, bson.D{
{"_id", objId},
{"string", "This is a string"},
{"int32", int32(32)},
{"int64", int64(64)},
{"double", 3.14},
{"bool", true},
{"datetime", ts},
{"embeddedDocument", bson.D{
{"field1", "value1"},
{"field2", "value2"},
{Key: "_id", Value: objId},
{Key: "string", Value: "This is a string"},
{Key: "int32", Value: int32(32)},
{Key: "int64", Value: int64(64)},
{Key: "double", Value: 3.14},
{Key: "bool", Value: true},
{Key: "datetime", Value: ts},
{Key: "embeddedDocument", Value: bson.D{
{Key: "field1", Value: "value1"},
{Key: "field2", Value: "value2"},
}},
{"embeddedMap", bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}},
{"array", bson.A{"item1", 2, true, 3.14}},
{"binary", []byte("binary data")},
{"objectId", objId},
{"null", nil},
{"timestamp", primitive.Timestamp{T: uint32(ts.Unix()), I: 1}},
{"minKey", primitive.MinKey{}},
{"maxKey", primitive.MaxKey{}},
{Key: "embeddedMap", Value: bson.M{"foo": "bar", "hello": "world", "pi": 3.14159}},
{Key: "array", Value: bson.A{"item1", 2, true, 3.14}},
{Key: "binary", Value: []byte("binary data")},
{Key: "objectId", Value: objId},
{Key: "null", Value: nil},
{Key: "timestamp", Value: primitive.Timestamp{T: uint32(ts.Unix()), I: 1}},
{Key: "minKey", Value: primitive.MinKey{}},
{Key: "maxKey", Value: primitive.MaxKey{}},
})
if err != nil {
return fmt.Errorf("failed to insert row: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions sources/mongo/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func newStreamingIterator(ctx context.Context, db *mongo.Database, cfg config.Mo

// We only care about DMLs, the full list can be found here: https://www.mongodb.com/docs/manual/reference/change-events/
pipeline := mongo.Pipeline{
{{"$match", bson.D{
{"operationType", bson.D{
{"$in", bson.A{"insert", "update", "delete", "replace"}},
{{Key: "$match", Value: bson.D{
{Key: "operationType", Value: bson.D{
{Key: "$in", Value: bson.A{"insert", "update", "delete", "replace"}},
}},
}}},
}
Expand Down

0 comments on commit c770bfb

Please sign in to comment.