mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2024-12-22 16:37:59 +00:00
Fix format errors and add gofmt and golines to Makefile
This commit is contained in:
parent
2807e2afc9
commit
2571e22843
6
Makefile
6
Makefile
@ -22,8 +22,14 @@ install-tools:
|
|||||||
@command $(GOPATH)/shadow > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
@command $(GOPATH)/shadow > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@v0.1.7; \
|
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@v0.1.7; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@command $(GOPATH)/golines > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
go install github.com/segmentio/golines@latest; \
|
||||||
|
fi
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: install-tools
|
lint: install-tools
|
||||||
|
gofmt -l . && test -z $$(gofmt -l .)
|
||||||
|
golines -l . && test -z $$(golines -l .)
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
shadow ./...
|
shadow ./...
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ func TestHost(t *testing.T) {
|
|||||||
|
|
||||||
func TestClientPort(t *testing.T) {
|
func TestClientPort(t *testing.T) {
|
||||||
req, _ := http.NewRequest("GET", "/client-port", nil)
|
req, _ := http.NewRequest("GET", "/client-port", nil)
|
||||||
req.RemoteAddr = net.JoinHostPort(testIP.ipv4 , "1000")
|
req.RemoteAddr = net.JoinHostPort(testIP.ipv4, "1000")
|
||||||
req.Header.Set("X-Real-IP", testIP.ipv4)
|
req.Header.Set("X-Real-IP", testIP.ipv4)
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
@ -118,7 +118,7 @@ X-Real-Ip: 81.2.69.192
|
|||||||
`
|
`
|
||||||
|
|
||||||
req, _ := http.NewRequest("GET", "/all", nil)
|
req, _ := http.NewRequest("GET", "/all", nil)
|
||||||
req.RemoteAddr = net.JoinHostPort(testIP.ipv4 , "1000")
|
req.RemoteAddr = net.JoinHostPort(testIP.ipv4, "1000")
|
||||||
req.Host = "test"
|
req.Host = "test"
|
||||||
req.Header.Set("X-Real-IP", testIP.ipv4)
|
req.Header.Set("X-Real-IP", testIP.ipv4)
|
||||||
req.Header.Set("Header1", "one")
|
req.Header.Set("Header1", "one")
|
||||||
|
Loading…
Reference in New Issue
Block a user