From 475b7b4c490bc3729772932f2d7bbcabb8f781a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sun, 24 Feb 2019 17:40:52 +0100 Subject: [PATCH] a round of cleanup --- Makefile | 4 ++-- bug/bug_actions_test.go | 3 +-- bug/bug_test.go | 3 +-- bug/label.go | 2 +- graphql/handler.go | 3 ++- repository/tree_entry_test.go | 3 ++- util/text/text.go | 7 ------- 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 7fb049773dd7d4ae85d8c58d3f71fc5c108b8ee2..94a820d5c6e6f3061275ae1e433361f6d8acaa87 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ debug-build: install: go generate - go install . + go install -ldflags "$(LDFLAGS)" . test: go test -bench=. ./... @@ -30,7 +30,7 @@ pack-webui: # produce a build that will fetch the web UI from the filesystem instead of from the binary debug-webui: - go build -tags=debugwebui + go build -ldflags "$(LDFLAGS)" -tags=debugwebui clean-local-bugs: git for-each-ref refs/bugs/ | cut -f 2 | xargs -r -n 1 git update-ref -d diff --git a/bug/bug_actions_test.go b/bug/bug_actions_test.go index 4d42fb1dd55e1bc8fe7099ab0e2940b9b2c1fc31..345b5e9a15a219b3bc80d34b596b194eac6dbaf3 100644 --- a/bug/bug_actions_test.go +++ b/bug/bug_actions_test.go @@ -1,13 +1,12 @@ package bug import ( + "testing" "time" "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/util/test" "github.com/stretchr/testify/require" - - "testing" ) func TestPushPull(t *testing.T) { diff --git a/bug/bug_test.go b/bug/bug_test.go index e104f9219a703dc50bd0b9cb9e182334d4b3487e..4c3952ebe210499928414b0e60cf65f4c78ec85f 100644 --- a/bug/bug_test.go +++ b/bug/bug_test.go @@ -1,13 +1,12 @@ package bug import ( + "testing" "time" "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/repository" "github.com/stretchr/testify/assert" - - "testing" ) func TestBugId(t *testing.T) { diff --git a/bug/label.go b/bug/label.go index b73222ddb86117724e39c0e4c8e9075e2f0ede01..0ad84f224929f3c6aa9f2bfc7955ba5022049d75 100644 --- a/bug/label.go +++ b/bug/label.go @@ -28,7 +28,7 @@ func (l *Label) UnmarshalGQL(v interface{}) error { // MarshalGQL implements the graphql.Marshaler interface func (l Label) MarshalGQL(w io.Writer) { - w.Write([]byte(`"` + l.String() + `"`)) + _, _ = w.Write([]byte(`"` + l.String() + `"`)) } func (l Label) Validate() error { diff --git a/graphql/handler.go b/graphql/handler.go index 1e8498c821917c6e2b151c2b7d05390e8d4c6f6a..aadcf4cbda7fa4b0df1141837b57c96d6355860f 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -4,11 +4,12 @@ package graphql import ( + "net/http" + "github.com/99designs/gqlgen/handler" "github.com/MichaelMure/git-bug/graphql/graph" "github.com/MichaelMure/git-bug/graphql/resolvers" "github.com/MichaelMure/git-bug/repository" - "net/http" ) // Handler is the root GraphQL http handler diff --git a/repository/tree_entry_test.go b/repository/tree_entry_test.go index b5f774d3e95e7fde69dbd9b60687e2fbda06b5c5..58da075cf002df552d4c1038ecd13e1f110a3acd 100644 --- a/repository/tree_entry_test.go +++ b/repository/tree_entry_test.go @@ -1,8 +1,9 @@ package repository import ( - "github.com/MichaelMure/git-bug/util/git" "testing" + + "github.com/MichaelMure/git-bug/util/git" ) func TestTreeEntryFormat(t *testing.T) { diff --git a/util/text/text.go b/util/text/text.go index 81cc870b6287efe83777dd9544804f3c56dae5ce..87db8c303525504dc929d634f12e08ad5c2471a6 100644 --- a/util/text/text.go +++ b/util/text/text.go @@ -323,10 +323,3 @@ func splitWord(word string, length int) (string, string) { return string(result), string(leftover) } - -func minInt(a, b int) int { - if a > b { - return b - } - return a -}