From 2571e228432c937f78b1fcc8719ee359f36f8fa7 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sun, 21 Nov 2021 18:23:36 +0100 Subject: [PATCH] Fix format errors and add gofmt and golines to Makefile --- Makefile | 6 ++++++ router/generic_test.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 552e140..66b6db6 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,14 @@ install-tools: @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; \ fi + + @command $(GOPATH)/golines > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ + go install github.com/segmentio/golines@latest; \ + fi .PHONY: lint lint: install-tools + gofmt -l . && test -z $$(gofmt -l .) + golines -l . && test -z $$(golines -l .) golangci-lint run shadow ./... diff --git a/router/generic_test.go b/router/generic_test.go index 76bf0a1..d0d375b 100644 --- a/router/generic_test.go +++ b/router/generic_test.go @@ -49,7 +49,7 @@ func TestHost(t *testing.T) { func TestClientPort(t *testing.T) { 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) w := httptest.NewRecorder() @@ -118,7 +118,7 @@ X-Real-Ip: 81.2.69.192 ` req, _ := http.NewRequest("GET", "/all", nil) - req.RemoteAddr = net.JoinHostPort(testIP.ipv4 , "1000") + req.RemoteAddr = net.JoinHostPort(testIP.ipv4, "1000") req.Host = "test" req.Header.Set("X-Real-IP", testIP.ipv4) req.Header.Set("Header1", "one")