From 63e135dc54e4d5b7fdb4b406cbe5afd7b9c83141 Mon Sep 17 00:00:00 2001 From: spacewander Date: Tue, 8 Oct 2019 11:40:00 +0800 Subject: [PATCH] test: tweak CI configure --- .golangci.yml | 3 +++ .travis.yml | 17 +++++++++-------- suffix.go | 4 +--- 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..e9133d7 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,3 @@ +run: + skip-files: + - ".*_test.go$" diff --git a/.travis.yml b/.travis.yml index 856dd2e..94f41e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ language: go +go: + - 1.12 + script: - - go test -covermode count -coverprofile coverage.txt -args -alhoc -after_success: - # See https://github.com/codecov/example-go - - bash <(curl -s https://codecov.io/bash) + - set -e + - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.17.1 + - ./bin/golangci-lint run ./... + - go test -v -coverprofile cover.out -args -alhoc -go: - - 1.6 - - 1.7 - - tip +after_success: + - bash <(curl -s https://codecov.io/bash) -f cover.out diff --git a/suffix.go b/suffix.go index 9c57766..668b7a5 100644 --- a/suffix.go +++ b/suffix.go @@ -277,7 +277,6 @@ func (node *_Node) longestSuffix(key []byte) (matchedKey []byte, value interface if found { return matchedKey, value, found } - break } } } else if keyLen == edgeLabelLen { @@ -290,7 +289,6 @@ func (node *_Node) longestSuffix(key []byte) (matchedKey []byte, value interface if found { return matchedKey, value, found } - break } } } else { @@ -514,7 +512,7 @@ func (tree *Tree) Walk(f func(key []byte, value interface{}) bool) { func (tree *Tree) WalkSuffix(suffix []byte, f func(key []byte, value interface{}) bool) { if len(tree.root.edges) != 0 { stop := false - if suffix == nil || len(suffix) == 0 { + if len(suffix) == 0 { tree.root.walk([]byte{}, f, &stop) } else { startingPoint, extraLabel, found := tree.root.getPointHasSuffix(suffix)