From 6ad3fe78b70bf863f4b55d9382b793b18559782c Mon Sep 17 00:00:00 2001 From: Yiling-J Date: Fri, 6 Dec 2024 13:30:03 +0800 Subject: [PATCH] Rename wire_gen file and add makefile (#199) * Rename wire_gen file and add makefile * update go mod --- Makefile | 25 +++++++++++++++++++++ component/{wire_gen.go => wire_gen_test.go} | 0 2 files changed, 25 insertions(+) create mode 100644 Makefile rename component/{wire_gen.go => wire_gen_test.go} (100%) 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