Merge pull request #663 from tsenart/master

Making code formatting consistent.
This commit is contained in:
Brandon Philips 2014-03-27 17:08:12 -07:00
commit eeca12a4c0
16 changed files with 62 additions and 58 deletions

View File

@ -1,8 +1,9 @@
package log package log
import ( import (
golog "github.com/coreos/etcd/third_party/github.com/coreos/go-log/log"
"os" "os"
golog "github.com/coreos/etcd/third_party/github.com/coreos/go-log/log"
) )
// The Verbose flag turns on verbose logging. // The Verbose flag turns on verbose logging.

View File

@ -133,7 +133,6 @@ func views_stats_html() ([]byte, error) {
) )
} }
// Asset loads and returns the asset for the given name. // Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or // It returns an error if the asset could not be found or
// could not be loaded. // could not be loaded.
@ -157,5 +156,4 @@ var _bindata = map[string] func() ([]byte, error) {
"views/browser.html": views_browser_html, "views/browser.html": views_browser_html,
"views/home.html": views_home_html, "views/home.html": views_home_html,
"views/stats.html": views_stats_html, "views/stats.html": views_stats_html,
} }

View File

@ -46,7 +46,7 @@ func NewRegistry(s store.Store) *Registry {
// Peers returns a list of cached peer names. // Peers returns a list of cached peer names.
func (r *Registry) Peers() []string { func (r *Registry) Peers() []string {
names := make([]string, 0, len(r.peers)) names := make([]string, 0, len(r.peers))
for name, _ := range r.peers { for name := range r.peers {
names = append(names, name) names = append(names, name)
} }
sort.Sort(sort.StringSlice(names)) sort.Sort(sort.StringSlice(names))
@ -56,7 +56,7 @@ func (r *Registry) Peers() []string {
// Proxies returns a list of cached proxy names. // Proxies returns a list of cached proxy names.
func (r *Registry) Proxies() []string { func (r *Registry) Proxies() []string {
names := make([]string, 0, len(r.proxies)) names := make([]string, 0, len(r.proxies))
for name, _ := range r.proxies { for name := range r.proxies {
names = append(names, name) names = append(names, name)
} }
sort.Sort(sort.StringSlice(names)) sort.Sort(sort.StringSlice(names))

View File

@ -1,8 +1,9 @@
package v1 package v1
import ( import (
"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
"net/http" "net/http"
"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
) )
// Removes a key from the store. // Removes a key from the store.

View File

@ -1,9 +1,10 @@
package v1 package v1
import ( import (
"net/http"
"github.com/coreos/etcd/store" "github.com/coreos/etcd/store"
"github.com/coreos/etcd/third_party/github.com/goraft/raft" "github.com/coreos/etcd/third_party/github.com/goraft/raft"
"net/http"
) )
// The Server interface provides all the methods required for the v1 API. // The Server interface provides all the methods required for the v1 API.

View File

@ -1,9 +1,10 @@
package v2 package v2
import ( import (
"net/http"
"github.com/coreos/etcd/store" "github.com/coreos/etcd/store"
"github.com/coreos/etcd/third_party/github.com/goraft/raft" "github.com/coreos/etcd/third_party/github.com/goraft/raft"
"net/http"
) )
// The Server interface provides all the methods required for the v2 API. // The Server interface provides all the methods required for the v2 API.

View File

@ -1,10 +1,11 @@
package v2 package v2
import ( import (
"time"
"github.com/coreos/etcd/log" "github.com/coreos/etcd/log"
"github.com/coreos/etcd/store" "github.com/coreos/etcd/store"
"github.com/coreos/etcd/third_party/github.com/goraft/raft" "github.com/coreos/etcd/third_party/github.com/goraft/raft"
"time"
) )
func init() { func init() {

View File

@ -12,8 +12,8 @@ import (
"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert" "github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
etcdtest "github.com/coreos/etcd/tests"
"github.com/coreos/etcd/server" "github.com/coreos/etcd/server"
etcdtest "github.com/coreos/etcd/tests"
goetcd "github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd" goetcd "github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
) )
@ -294,7 +294,7 @@ func TestDiscoverySecondPeerUp(t *testing.T) {
func assertServerNotUp(client http.Client, scheme string) error { func assertServerNotUp(client http.Client, scheme string) error {
path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme) path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme)
fields := url.Values(map[string][]string{"value": []string{"bar"}}) fields := url.Values(map[string][]string{"value": {"bar"}})
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)

View File

@ -145,7 +145,6 @@ func TestTLSUnauthenticatedClient(t *testing.T) {
} }
} }
func buildClient() http.Client { func buildClient() http.Client {
return http.Client{} return http.Client{}
} }
@ -189,7 +188,7 @@ func stopServer(proc *os.Process) {
func assertServerFunctional(client http.Client, scheme string) error { func assertServerFunctional(client http.Client, scheme string) error {
path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme) path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme)
fields := url.Values(map[string][]string{"value": []string{"bar"}}) fields := url.Values(map[string][]string{"value": {"bar"}})
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
@ -220,7 +219,7 @@ func assertServerFunctional(client http.Client, scheme string) error {
func assertServerNotFunctional(client http.Client, scheme string) error { func assertServerNotFunctional(client http.Client, scheme string) error {
path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme) path := fmt.Sprintf("%s://127.0.0.1:4001/v2/keys/foo", scheme)
fields := url.Values(map[string][]string{"value": []string{"bar"}}) fields := url.Values(map[string][]string{"value": {"bar"}})
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)

View File

@ -35,7 +35,7 @@ func TestProxy(t *testing.T) {
time.Sleep(time.Second) time.Sleep(time.Second)
// Check that all peers and proxies have the value. // Check that all peers and proxies have the value.
for i, _ := range etcds { for i := range etcds {
resp, err := tests.Get(fmt.Sprintf("http://localhost:%d/v2/keys/foo", 4000+(i+1))) resp, err := tests.Get(fmt.Sprintf("http://localhost:%d/v2/keys/foo", 4000+(i+1)))
if assert.NoError(t, err) { if assert.NoError(t, err) {
body := tests.ReadBodyJSON(resp) body := tests.ReadBodyJSON(resp)

View File

@ -19,13 +19,14 @@ package test
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
"os" "os"
"strconv" "strconv"
"time" "time"
"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
) )
var client = http.Client{ var client = http.Client{

View File

@ -1,9 +1,10 @@
package mock package mock
import ( import (
"time"
"github.com/coreos/etcd/store" "github.com/coreos/etcd/store"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"time"
) )
// A mock Store object used for testing. // A mock Store object used for testing.