Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sbueringer committed Sep 10, 2018
1 parent 50da2c5 commit ddc0a78
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func handleTags(consul *api.Client, target string, recursive bool) (*datasource.
return qr, nil
}

func handleTable(consul *api.Client, qs []query) (*datasource.DatasourceResponse) {
func handleTable(consul *api.Client, qs []query) *datasource.DatasourceResponse {

var qrs []*datasource.QueryResult
for _, q := range qs {
Expand Down Expand Up @@ -373,10 +373,10 @@ func newConsulFromReq(req *datasource.DatasourceRequest) (*api.Client, string, e
return consul, consulToken, nil
}

type consulClientEntry struct{
consulAddr string
type consulClientEntry struct {
consulAddr string
consulToken string
client *api.Client
client *api.Client
}

var consulClientCache = map[int64]consulClientEntry{}
Expand Down
3 changes: 2 additions & 1 deletion datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
"fmt"
"strings"

"github.com/sergi/go-diff/diffmatchpatch"
"context"

"github.com/grafana/grafana_plugin_model/go/datasource"
"github.com/sergi/go-diff/diffmatchpatch"
)

func TestQuery(t *testing.T) {
Expand Down
Binary file modified dist/grafana-consul-plugin_linux_amd64
Binary file not shown.
25 changes: 13 additions & 12 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package main

import (
"github.com/hashicorp/consul/testutil"
"github.com/hashicorp/consul/api"
"io/ioutil"
"fmt"
"path/filepath"
"encoding/json"
"sync"
"fmt"
"io/ioutil"
"os"
"os/signal"
"path/filepath"
"sync"

"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/testutil"
)

func main(){
func main() {
fmt.Println("Starting Consul")
srv := startServer()
defer srv.Stop()
Expand Down Expand Up @@ -58,8 +59,8 @@ func startServer() *testutil.TestServer {
}

_, _, err = consul.ACL().Create(&api.ACLEntry{
ID: "master",
Type: "client",
ID: "master",
Type: "client",
Rules: "key \"\" { policy = \"write\" }",
}, &api.WriteOptions{})
if err != nil {
Expand All @@ -85,7 +86,7 @@ func startServer() *testutil.TestServer {
if err != nil {
panic(fmt.Errorf("error reading import json file %s: %v", file, err))
}
var entries []*Entry
var entries []*entry
if err := json.Unmarshal([]byte(data), &entries); err != nil {
panic(fmt.Errorf("cannot unmarshal data: %s", err))
}
Expand All @@ -106,7 +107,7 @@ func startServer() *testutil.TestServer {
return srv
}

type Entry struct {
type entry struct {
Key string `json:"key"`
Flags uint64 `json:"flags"`
Value string `json:"value"`
Expand All @@ -124,4 +125,4 @@ func newConsul(consulAddr, consulToken string) (*api.Client, error) {
}

return client, nil
}
}

0 comments on commit ddc0a78

Please sign in to comment.