mirror of
				https://github.com/appleboy/drone-ssh.git
				synced 2025-10-29 00:51:15 +08:00 
			
		
		
		
	refactor: check gofmt error.
This commit is contained in:
		
							parent
							
								
									c2776cbaed
								
							
						
					
					
						commit
						06c7e95113
					
				
							
								
								
									
										15
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								Makefile
									
									
									
									
									
								
							| @ -6,9 +6,11 @@ EXECUTABLE := drone-ssh | ||||
| # for dockerhub
 | ||||
| DEPLOY_ACCOUNT := appleboy | ||||
| DEPLOY_IMAGE := $(EXECUTABLE) | ||||
| GOFMT ?= gofmt "-s" | ||||
| 
 | ||||
| TARGETS ?= linux darwin windows | ||||
| PACKAGES ?= $(shell go list ./... | grep -v /vendor/) | ||||
| GOFILES := find . -name "*.go" -type f -not -path "./vendor/*" | ||||
| SOURCES ?= $(shell find . -name "*.go" -type f) | ||||
| TAGS ?= | ||||
| LDFLAGS ?= -X 'main.Version=$(VERSION)' | ||||
| @ -27,8 +29,17 @@ endif | ||||
| 
 | ||||
| all: build | ||||
| 
 | ||||
| .PHONY: fmt-check | ||||
| fmt-check: | ||||
| 	# get all go files and run go fmt on them | ||||
| 	@files=$$($(GOFILES) | xargs $(GOFMT) -l); if [ -n "$$files" ]; then \
 | ||||
| 		echo "Please run 'make fmt' and commit the result:"; \
 | ||||
| 		echo "$${files}"; \
 | ||||
| 		exit 1; \
 | ||||
| 		fi; | ||||
| 
 | ||||
| fmt: | ||||
| 	find . -name "*.go" -type f -not -path "./vendor/*" | xargs gofmt -s -w | ||||
| 	$(GOFILES) | xargs $(GOFMT) -w | ||||
| 
 | ||||
| vet: | ||||
| 	go vet $(PACKAGES) | ||||
| @ -51,7 +62,7 @@ unconvert: | ||||
| 	fi | ||||
| 	for PKG in $(PACKAGES); do unconvert -v $$PKG || exit 1; done; | ||||
| 
 | ||||
| test: | ||||
| test: fmt-check | ||||
| 	for PKG in $(PACKAGES); do go test -v -cover -coverprofile $$GOPATH/src/$$PKG/coverage.txt $$PKG || exit 1; done; | ||||
| 
 | ||||
| html: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Bo-Yi Wu
						Bo-Yi Wu