Merge pull request #1527 from codysoyland/1509-metalinter-gofmt

Fix linter issues: gofmt
This commit is contained in:
Cody Soyland 2018-07-17 07:51:51 -05:00 committed by GitHub
commit b67bd2bf3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 38 deletions

View file

@ -109,7 +109,7 @@ docker-test:
docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) golang:$(GO_VERSION) go test -tags='$(BUILD_TAGS)' $(TESTFLAGS) ./...
metalinter:
gometalinter --vendor --disable-all --enable=gotype --enable=gotypex --deadline=60s --exclude "^internal/.*\.pb\.go" ./...
gometalinter --vendor --disable-all --enable=gotype --enable=gotypex --enable=gofmt --deadline=60s --exclude "^internal/.*\.pb\.go" ./...
######################
# Build dependencies #

44
api.go
View file

@ -858,32 +858,32 @@ const (
)
var methodsCommon = map[apiMethod]struct{}{
apiClusterMessage: struct{}{},
apiSetCoordinator: struct{}{},
apiClusterMessage: {},
apiSetCoordinator: {},
}
var methodsResizing = map[apiMethod]struct{}{
apiResizeAbort: struct{}{},
apiResizeAbort: {},
}
var methodsNormal = map[apiMethod]struct{}{
apiCreateField: struct{}{},
apiCreateIndex: struct{}{},
apiDeleteField: struct{}{},
apiDeleteIndex: struct{}{},
apiDeleteView: struct{}{},
apiExportCSV: struct{}{},
apiFragmentBlockData: struct{}{},
apiFragmentBlocks: struct{}{},
apiField: struct{}{},
apiFieldAttrDiff: struct{}{},
apiImport: struct{}{},
apiImportValue: struct{}{},
apiIndex: struct{}{},
apiIndexAttrDiff: struct{}{},
apiQuery: struct{}{},
apiRecalculateCaches: struct{}{},
apiRemoveNode: struct{}{},
apiShardNodes: struct{}{},
apiViews: struct{}{},
apiCreateField: {},
apiCreateIndex: {},
apiDeleteField: {},
apiDeleteIndex: {},
apiDeleteView: {},
apiExportCSV: {},
apiFragmentBlockData: {},
apiFragmentBlocks: {},
apiField: {},
apiFieldAttrDiff: {},
apiImport: {},
apiImportValue: {},
apiIndex: {},
apiIndexAttrDiff: {},
apiQuery: {},
apiRecalculateCaches: {},
apiRemoveNode: {},
apiShardNodes: {},
apiViews: {},
}

View file

@ -182,9 +182,9 @@ func TestFragSources(t *testing.T) {
to: c2,
idx: idx,
expected: map[string][]*ResizeSource{
"node0": []*ResizeSource{},
"node1": []*ResizeSource{},
"node2": []*ResizeSource{
"node0": {},
"node1": {},
"node2": {
{&Node{"node0", URI{"http", "host0", 10101}, false}, "i", "f", "standard", uint64(0)},
{&Node{"node1", URI{"http", "host1", 10101}, false}, "i", "f", "standard", uint64(2)},
},
@ -196,10 +196,10 @@ func TestFragSources(t *testing.T) {
to: c3,
idx: idx,
expected: map[string][]*ResizeSource{
"node0": []*ResizeSource{
"node0": {
{&Node{"node1", URI{"http", "host1", 10101}, false}, "i", "f", "standard", uint64(1)},
},
"node1": []*ResizeSource{
"node1": {
{&Node{"node0", URI{"http", "host0", 10101}, false}, "i", "f", "standard", uint64(0)},
{&Node{"node0", URI{"http", "host0", 10101}, false}, "i", "f", "standard", uint64(2)},
},
@ -211,14 +211,14 @@ func TestFragSources(t *testing.T) {
to: c4,
idx: idx,
expected: map[string][]*ResizeSource{
"node0": []*ResizeSource{
"node0": {
{&Node{"node2", URI{"http", "host2", 10101}, false}, "i", "f", "standard", uint64(0)},
{&Node{"node2", URI{"http", "host2", 10101}, false}, "i", "f", "standard", uint64(2)},
},
"node1": []*ResizeSource{
"node1": {
{&Node{"node0", URI{"http", "host0", 10101}, false}, "i", "f", "standard", uint64(3)},
},
"node2": []*ResizeSource{},
"node2": {},
},
err: "",
},

View file

@ -158,7 +158,7 @@ func (ct *commandTest) setupCommand(t *testing.T) *cobra.Command {
// reset the environment after setup/run of a commandTest.
func (ct *commandTest) reset() {
for name, _ := range ct.env {
for name := range ct.env {
os.Setenv(name, "")
}
}

View file

@ -600,7 +600,7 @@ func (f *Field) viewNames() []string {
defer f.mu.Unlock()
other := make([]string, 0, len(f.viewMap))
for viewName, _ := range f.viewMap {
for viewName := range f.viewMap {
other = append(other, viewName)
}
return other

View file

@ -1,11 +1,10 @@
package test
import (
"testing"
"github.com/pilosa/pilosa/pql"
"testing"
)
func TestPQL_Generator(t *testing.T) {
t.Run("pql.Query generator", func(t *testing.T) {
for _, u := range []struct {

View file

@ -47,8 +47,8 @@ func TestParser_Parse(t *testing.T) {
&pql.Call{
Name: "Union",
Children: []*pql.Call{
&pql.Call{Name: "Bitmap"},
&pql.Call{Name: "Count"},
{Name: "Bitmap"},
{Name: "Count"},
},
},
) {

View file

@ -38,7 +38,7 @@ func TestMain_SendReceiveMessage(t *testing.T) {
// Expected indexes and Fields
expected := map[string][]string{
"i": []string{"f"},
"i": {"f"},
}
// Create a client for each node.