diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f46e7380 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +.PHONY: test lint cover mock_wire mock_gen + +test: + go test ./... + +lint: + golangci-lint run + +cover: + go test -coverprofile=cover.out -coverpkg=./... ./... + go tool cover -html=cover.out -o cover.html + open cover.html + +mock_wire: + @echo "Running wire for component mocks..." + @go run -mod=mod github.com/google/wire/cmd/wire opencsg.com/csghub-server/component + @if [ $$? -eq 0 ]; then \ + echo "Renaming wire_gen.go to wire_gen_test.go..."; \ + mv component/wire_gen.go component/wire_gen_test.go; \ + else \ + echo "Wire failed, skipping renaming."; \ + fi + +mock_gen: + mockery diff --git a/component/wire_gen.go b/component/wire_gen_test.go similarity index 100% rename from component/wire_gen.go rename to component/wire_gen_test.go diff --git a/go.sum b/go.sum index db898931..50057773 100644 --- a/go.sum +++ b/go.sum @@ -303,6 +303,7 @@ github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2 github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=