refactor: update gofmt check (#233)
This commit is contained in:
		
							parent
							
								
									5651d9e51f
								
							
						
					
					
						commit
						fb7109835a
					
				
							
								
								
									
										11
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										11
									
								
								Makefile
								
								
								
								
							| 
						 | 
					@ -10,7 +10,7 @@ GOFMT ?= gofmt "-s"
 | 
				
			||||||
TARGETS ?= linux darwin windows
 | 
					TARGETS ?= linux darwin windows
 | 
				
			||||||
ARCHS ?= amd64 386
 | 
					ARCHS ?= amd64 386
 | 
				
			||||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
 | 
					PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
 | 
				
			||||||
GOFILES := find . -name "*.go" -type f -not -path "./vendor/*"
 | 
					GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
 | 
				
			||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
 | 
					SOURCES ?= $(shell find . -name "*.go" -type f)
 | 
				
			||||||
TAGS ?=
 | 
					TAGS ?=
 | 
				
			||||||
LDFLAGS ?= -X 'main.Version=$(VERSION)'
 | 
					LDFLAGS ?= -X 'main.Version=$(VERSION)'
 | 
				
			||||||
| 
						 | 
					@ -42,16 +42,17 @@ endif
 | 
				
			||||||
	@echo "Already set ANDROID_API_KEY and ANDROID_TEST_TOKEN globale variable."
 | 
						@echo "Already set ANDROID_API_KEY and ANDROID_TEST_TOKEN globale variable."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fmt:
 | 
					fmt:
 | 
				
			||||||
	$(GOFILES) | xargs $(GOFMT) -w
 | 
						$(GOFMT) -w $(GOFILES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: fmt-check
 | 
					.PHONY: fmt-check
 | 
				
			||||||
fmt-check:
 | 
					fmt-check:
 | 
				
			||||||
	# get all go files and run go fmt on them
 | 
						# get all go files and run go fmt on them
 | 
				
			||||||
	@files=$$($(GOFILES) | xargs $(GOFMT) -l); if [ -n "$$files" ]; then \
 | 
						@diff=$$($(GOFMT) -d $(GOFILES)); \
 | 
				
			||||||
 | 
						if [ -n "$$diff" ]; then \
 | 
				
			||||||
		echo "Please run 'make fmt' and commit the result:"; \
 | 
							echo "Please run 'make fmt' and commit the result:"; \
 | 
				
			||||||
		echo "$${files}"; \
 | 
							echo "$${diff}"; \
 | 
				
			||||||
		exit 1; \
 | 
							exit 1; \
 | 
				
			||||||
		fi;
 | 
						fi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vet:
 | 
					vet:
 | 
				
			||||||
	go vet $(PACKAGES)
 | 
						go vet $(PACKAGES)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue