53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # Makefile for pig-farm-controller
 | |
| 
 | |
| # 默认目标
 | |
| .PHONY: help
 | |
| help:
 | |
| 	@echo "Usage: make [target]"
 | |
| 	@echo
 | |
| 	@echo "Targets:"
 | |
| 	@echo "  run          Run the application"
 | |
| 	@echo "  build        Build the application"
 | |
| 	@echo "  clean        Clean generated files"
 | |
| 	@echo "  test         Run all tests"
 | |
| 	@echo "	 swag         Generate swagger docs"
 | |
| 	@echo "  help         Show this help message"
 | |
| 	@echo "  proto        Generate protobuf files"
 | |
| 	@echo "	 lint         Lint the code"
 | |
| 
 | |
| # 运行应用
 | |
| .PHONY: run
 | |
| run:
 | |
| 	go run main.go
 | |
| 
 | |
| # 构建应用
 | |
| .PHONY: build
 | |
| build:
 | |
| 	go build -o bin/pig-farm-controller .
 | |
| 
 | |
| # 清理生成文件
 | |
| .PHONY: clean
 | |
| clean:
 | |
| 	rm -f bin/pig-farm-controller
 | |
| 
 | |
| # 运行所有测试
 | |
| .PHONY: test
 | |
| test:
 | |
| 	go test --count=1 ./...
 | |
| 
 | |
| # 生成swagger文档
 | |
| .PHONY: swag
 | |
| swag:
 | |
| 	if exist docs rmdir /s /q docs
 | |
| 	swag init --parseInternal --parseDependency
 | |
| 
 | |
| 
 | |
| # 生成protobuf文件
 | |
| .PHONY: proto
 | |
| proto:
 | |
| 	protoc --go_out=internal/domain/device/proto --go_opt=paths=source_relative --go-grpc_out=internal/domain/device/proto --go-grpc_opt=paths=source_relative -Iinternal/domain/device/proto internal/domain/device/proto/device.proto
 | |
| 
 | |
| # 运行代码检查
 | |
| .PHONY: lint
 | |
| lint:
 | |
| 	golangci-lint run ./...
 |