From 76bad8c8f22e74907e0a8162a9b00e18558394fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Wed, 20 Apr 2022 20:01:10 -0300 Subject: [PATCH] Try to fix CI again --- Makefile | 12 +++++++++--- examples/all_adapters/all_adapters.go | 4 ---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 4c3285e..f265caa 100644 --- a/Makefile +++ b/Makefile @@ -5,24 +5,30 @@ GOBIN=$(shell go env GOPATH)/bin TIME=1s -test: setup +test: setup go-mod-tidy $(GOBIN)/richgo test $(path) $(args) + @( cd benchmarks ; $(GOBIN)/richgo test $(path) $(args) ) + @( cd examples ; $(GOBIN)/richgo test $(path) $(args) ) @( cd adapters/kpgx ; $(GOBIN)/richgo test $(path) $(args) ) @( cd adapters/kmysql ; $(GOBIN)/richgo test $(path) $(args) ) @( cd adapters/ksqlserver ; $(GOBIN)/richgo test $(path) $(args) ) @( cd adapters/ksqlite3 ; $(GOBIN)/richgo test $(path) $(args) ) -bench: +bench: go-mod-tidy cd benchmarks && go test -bench=. -benchtime=$(TIME) @echo "Benchmark executed at: $$(date --iso)" @echo "Benchmark executed on commit: $$(git rev-parse HEAD)" -lint: setup +lint: setup go-mod-tidy @$(GOBIN)/staticcheck $(path) $(args) @go vet $(path) $(args) @make --no-print-directory -C benchmarks @echo "StaticCheck & Go Vet found no problems on your code!" +# Run go mod tidy for all submodules: +go-mod-tidy: + @find -name go.mod -execdir go mod tidy \; + gen: mock mock: setup $(GOBIN)/mockgen -package=exampleservice -source=contracts.go -destination=examples/example_service/mocks.go diff --git a/examples/all_adapters/all_adapters.go b/examples/all_adapters/all_adapters.go index 57e79f8..596fcc1 100644 --- a/examples/all_adapters/all_adapters.go +++ b/examples/all_adapters/all_adapters.go @@ -48,7 +48,6 @@ func main() { if err != nil { log.Fatalf("unable to open database, reason: %s", err) } - defer db.Close() _, err = db.Exec(ctx, `CREATE TABLE users ( id serial PRIMARY KEY, @@ -66,7 +65,6 @@ func main() { if err != nil { log.Fatalf("unable to open database: %s", err) } - defer db.Close() _, err = db.Exec(ctx, `CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -84,7 +82,6 @@ func main() { if err != nil { log.Fatalf("unable to open database: %s", err) } - defer db.Close() // In the example below NVARCHAR is the format // we are using for storing JSON: @@ -104,7 +101,6 @@ func main() { if err != nil { log.Fatalf("unable to open database: %s", err) } - defer db.Close() // In the definition below, please note that BLOB is // the only type we can use in sqlite for storing JSON.