Browse Source

Merge pull request #520 from philips/use-goven

Use goven for all third party dependencies
Brandon Philips 12 năm trước cách đây
mục cha
commit
272dc343ef
100 tập tin đã thay đổi với 703 bổ sung và 1126 xóa
  1. 2 1
      .gitignore
  2. 1 1
      bench/bench.go
  3. 10 2
      build
  4. 0 25
      build.ps1
  5. 8 8
      etcd.go
  6. 1 1
      log/log.go
  7. 1 1
      metrics/metrics.go
  8. 1 1
      metrics/nil.go
  9. 11 12
      metrics/standard.go
  10. 5 5
      mod/dashboard/resources/bindata-file.go
  11. 1 1
      mod/dashboard/resources/bindata-toc.go
  12. 0 1
      mod/dashboard/resources/browser.html.go
  13. 0 1
      mod/dashboard/resources/index.html.go
  14. 0 1
      mod/dashboard/resources/scripts-browser-modules.js.go
  15. 0 1
      mod/dashboard/resources/scripts-browser-scripts.js.go
  16. 0 1
      mod/dashboard/resources/scripts-stats-modules.js.go
  17. 0 1
      mod/dashboard/resources/scripts-stats-scripts.js.go
  18. 0 1
      mod/dashboard/resources/stats.html.go
  19. 0 1
      mod/dashboard/resources/styles-main.css.go
  20. 0 1
      mod/dashboard/resources/views-browser.html.go
  21. 0 1
      mod/dashboard/resources/views-stats.html.go
  22. 1 1
      mod/leader/v2/delete_handler.go
  23. 1 1
      mod/leader/v2/get_handler.go
  24. 9 9
      mod/leader/v2/handler.go
  25. 1 1
      mod/leader/v2/set_handler.go
  26. 1 3
      mod/leader/v2/tests/mod_leader_test.go
  27. 7 7
      mod/lock/v2/acquire_handler.go
  28. 1 1
      mod/lock/v2/get_index_handler.go
  29. 6 6
      mod/lock/v2/handler.go
  30. 1 1
      mod/lock/v2/lock_nodes.go
  31. 2 3
      mod/lock/v2/release_handler.go
  32. 2 2
      mod/lock/v2/renew_handler.go
  33. 5 7
      mod/lock/v2/tests/mod_lock_test.go
  34. 3 3
      mod/mod.go
  35. 60 60
      server/config.go
  36. 2 2
      server/config_test.go
  37. 11 11
      server/join_command.go
  38. 35 35
      server/peer_server.go
  39. 2 2
      server/peer_server_handlers.go
  40. 19 19
      server/raft_server_stats.go
  41. 1 0
      server/release_version.go
  42. 1 1
      server/remove_command.go
  43. 17 17
      server/server.go
  44. 15 15
      server/transporter.go
  45. 1 1
      server/v1/delete_key_handler.go
  46. 1 1
      server/v1/get_key_handler.go
  47. 2 2
      server/v1/set_key_handler.go
  48. 1 1
      server/v1/v1.go
  49. 1 1
      server/v1/watch_key_handler.go
  50. 1 1
      server/v2/delete_handler.go
  51. 2 2
      server/v2/get_handler.go
  52. 1 1
      server/v2/post_handler.go
  53. 2 2
      server/v2/put_handler.go
  54. 1 1
      server/v2/tests/delete_handler_test.go
  55. 1 1
      server/v2/tests/get_handler_test.go
  56. 2 2
      server/v2/tests/post_handler_test.go
  57. 1 1
      server/v2/tests/put_handler_test.go
  58. 1 1
      server/v2/v2.go
  59. 1 1
      store/command_factory.go
  60. 1 1
      store/stats_test.go
  61. 1 1
      store/store_test.go
  62. 24 24
      store/v2/command_factory.go
  63. 4 4
      store/v2/compare_and_delete_command.go
  64. 6 6
      store/v2/compare_and_swap_command.go
  65. 6 6
      store/v2/create_command.go
  66. 4 4
      store/v2/delete_command.go
  67. 5 5
      store/v2/set_command.go
  68. 1 1
      store/v2/sync_command.go
  69. 4 4
      store/v2/update_command.go
  70. 13 10
      test.sh
  71. 2 2
      tests/functional/kill_random_test.go
  72. 1 1
      tests/functional/multi_node_kill_all_and_recovery_test.go
  73. 1 1
      tests/functional/multi_node_kill_one_test.go
  74. 1 1
      tests/functional/remove_node_test.go
  75. 1 1
      tests/functional/simple_multi_node_test.go
  76. 1 1
      tests/functional/simple_snapshot_test.go
  77. 1 1
      tests/functional/single_node_recovery_test.go
  78. 1 1
      tests/functional/single_node_test.go
  79. 2 2
      tests/functional/util.go
  80. 1 1
      tests/functional/v1_migration_test.go
  81. 2 2
      tests/mock/server_v2.go
  82. 13 13
      tests/server_utils.go
  83. 0 384
      third_party.go
  84. 0 11
      third_party/README
  85. 0 0
      third_party/bitbucket.org/kardianos/osext/LICENSE
  86. 0 0
      third_party/bitbucket.org/kardianos/osext/osext.go
  87. 0 0
      third_party/bitbucket.org/kardianos/osext/osext_plan9.go
  88. 0 0
      third_party/bitbucket.org/kardianos/osext/osext_procfs.go
  89. 0 0
      third_party/bitbucket.org/kardianos/osext/osext_sysctl.go
  90. 0 0
      third_party/bitbucket.org/kardianos/osext/osext_test.go
  91. 0 0
      third_party/bitbucket.org/kardianos/osext/osext_windows.go
  92. 0 0
      third_party/code.google.com/p/goprotobuf/proto/Makefile
  93. 316 316
      third_party/code.google.com/p/goprotobuf/proto/all_test.go
  94. 0 0
      third_party/code.google.com/p/goprotobuf/proto/clone.go
  95. 22 22
      third_party/code.google.com/p/goprotobuf/proto/clone_test.go
  96. 0 0
      third_party/code.google.com/p/goprotobuf/proto/decode.go
  97. 0 0
      third_party/code.google.com/p/goprotobuf/proto/encode.go
  98. 0 0
      third_party/code.google.com/p/goprotobuf/proto/equal.go
  99. 6 6
      third_party/code.google.com/p/goprotobuf/proto/equal_test.go
  100. 0 0
      third_party/code.google.com/p/goprotobuf/proto/extensions.go

+ 2 - 1
.gitignore

@@ -1,4 +1,5 @@
-pkg/
+/pkg
 /go-bindata
 /machine*
 /bin
+/src

+ 1 - 1
bench/bench.go

@@ -5,7 +5,7 @@ import (
 	"log"
 	"strconv"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 func write(endpoint string, requests int, end chan int) {

+ 10 - 2
build

@@ -1,4 +1,12 @@
 #!/bin/sh -e
 
-go run third_party.go install github.com/coreos/etcd
-go run third_party.go install github.com/coreos/etcd/bench
+if [ ! -h src/github.com/coreos/etcd ]; then
+	mkdir -p src/github.com/coreos/
+	ln -s ../../.. src/github.com/coreos/etcd
+fi
+
+export GOBIN=${PWD}/bin
+export GOPATH=${PWD}
+
+go install github.com/coreos/etcd
+go install github.com/coreos/etcd/bench

+ 0 - 25
build.ps1

@@ -1,25 +0,0 @@
-
-$ETCD_PACKAGE="github.com/coreos/etcd"
-$env:GOPATH=$pwd.Path
-$SRC_DIR="$env:GOPATH/src"
-$ETCD_DIR="$SRC_DIR/$ETCD_PACKAGE"
-$env:ETCD_DIR="$SRC_DIR/$ETCD_PACKAGE"
-$env:ETCD_TARGET=$pwd.Path
-
-$ETCD_BASE=(Split-Path $ETCD_DIR -Parent)
-if(-not(test-path $ETCD_DIR)){
-	mkdir -force "$ETCD_BASE" > $null
-}
-
-if(-not(test-path $ETCD_DIR )){
-	cmd /c 'mklink /J "%ETCD_DIR%" %ETCD_TARGET%'
-}
-
-foreach($i in (ls third_party/*)){
-	if("$i" -eq "third_party/src") {continue}
-	
-	cp -Recurse -force "$i" src/
-}
-
-./scripts/release-version.ps1 | Out-File -Encoding UTF8 server/release_version.go
-go build -v "${ETCD_PACKAGE}"

+ 8 - 8
etcd.go

@@ -24,7 +24,7 @@ import (
 	"runtime"
 	"time"
 
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 
 	ehttp "github.com/coreos/etcd/http"
 	"github.com/coreos/etcd/log"
@@ -118,18 +118,18 @@ func main() {
 
 	// Calculate all of our timeouts
 	heartbeatTimeout := time.Duration(config.Peer.HeartbeatTimeout) * time.Millisecond
-	electionTimeout :=  time.Duration(config.Peer.ElectionTimeout) * time.Millisecond
+	electionTimeout := time.Duration(config.Peer.ElectionTimeout) * time.Millisecond
 	dialTimeout := (3 * heartbeatTimeout) + electionTimeout
 	responseHeaderTimeout := (3 * heartbeatTimeout) + electionTimeout
 
 	// Create peer server.
 	psConfig := server.PeerServerConfig{
-		Name:             info.Name,
-		Scheme:           peerTLSConfig.Scheme,
-		URL:              info.RaftURL,
-		SnapshotCount:    config.SnapshotCount,
-		MaxClusterSize:   config.MaxClusterSize,
-		RetryTimes:       config.MaxRetryAttempts,
+		Name:           info.Name,
+		Scheme:         peerTLSConfig.Scheme,
+		URL:            info.RaftURL,
+		SnapshotCount:  config.SnapshotCount,
+		MaxClusterSize: config.MaxClusterSize,
+		RetryTimes:     config.MaxRetryAttempts,
 	}
 	ps := server.NewPeerServer(psConfig, registry, store, &mb, followersStats, serverStats)
 

+ 1 - 1
log/log.go

@@ -1,7 +1,7 @@
 package log
 
 import (
-	golog "github.com/coreos/go-log/log"
+	golog "github.com/coreos/etcd/third_party/github.com/coreos/go-log/log"
 	"os"
 )
 

+ 1 - 1
metrics/metrics.go

@@ -7,7 +7,7 @@ package metrics
 import (
 	"io"
 
-	gometrics "github.com/rcrowley/go-metrics"
+	gometrics "github.com/coreos/etcd/third_party/github.com/rcrowley/go-metrics"
 )
 
 type Timer gometrics.Timer

+ 1 - 1
metrics/nil.go

@@ -3,7 +3,7 @@ package metrics
 import (
 	"io"
 
-	gometrics "github.com/rcrowley/go-metrics"
+	gometrics "github.com/coreos/etcd/third_party/github.com/rcrowley/go-metrics"
 )
 
 type nilBucket struct{}

+ 11 - 12
metrics/standard.go

@@ -6,26 +6,25 @@ import (
 	"sync"
 	"time"
 
-	gometrics "github.com/rcrowley/go-metrics"
+	gometrics "github.com/coreos/etcd/third_party/github.com/rcrowley/go-metrics"
 )
 
 const (
 	// RuntimeMemStatsSampleInterval is the interval in seconds at which the
 	// Go runtime's memory statistics will be gathered.
-	RuntimeMemStatsSampleInterval = time.Duration(2) * time.Second
+	RuntimeMemStatsSampleInterval	= time.Duration(2) * time.Second
 
 	// GraphitePublishInterval is the interval in seconds at which all
 	// gathered statistics will be published to a Graphite endpoint.
-	GraphitePublishInterval = time.Duration(2) * time.Second
+	GraphitePublishInterval	= time.Duration(2) * time.Second
 )
 
-
 type standardBucket struct {
 	sync.Mutex
-	name     string
-	registry gometrics.Registry
-	timers   map[string]Timer
-	gauges   map[string]Gauge
+	name		string
+	registry	gometrics.Registry
+	timers		map[string]Timer
+	gauges		map[string]Gauge
 }
 
 func newStandardBucket(name string) standardBucket {
@@ -35,10 +34,10 @@ func newStandardBucket(name string) standardBucket {
 	go gometrics.CaptureRuntimeMemStats(registry, RuntimeMemStatsSampleInterval)
 
 	return standardBucket{
-		name:     name,
-		registry: registry,
-		timers:   make(map[string]Timer),
-		gauges:   make(map[string]Gauge),
+		name:		name,
+		registry:	registry,
+		timers:		make(map[string]Timer),
+		gauges:		make(map[string]Gauge),
 	}
 }
 

+ 5 - 5
mod/dashboard/resources/bindata-file.go

@@ -1,11 +1,11 @@
 package resources
 
 func File(name string) ([]byte, bool) {
-       data, ok := go_bindata[name]
+	data, ok := go_bindata[name]
 
-       if ok == false {
-               return nil, false
-       }
+	if ok == false {
+		return nil, false
+	}
 
-       return data(), true
+	return data(), true
 }

+ 1 - 1
mod/dashboard/resources/bindata-toc.go

@@ -4,4 +4,4 @@ package resources
 // After startup of the program, all generated data files will
 // put themselves in this map. The key is the full filename, as
 // supplied to go-bindata.
-var go_bindata = make(map[string]func() []byte)
+var go_bindata = make(map[string]func() []byte)

+ 0 - 1
mod/dashboard/resources/browser.html.go

@@ -33,7 +33,6 @@ func browser_html() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/browser.html"] = browser_html
 }

+ 0 - 1
mod/dashboard/resources/index.html.go

@@ -33,7 +33,6 @@ func index_html() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/index.html"] = index_html
 }

+ 0 - 1
mod/dashboard/resources/scripts-browser-modules.js.go

@@ -33,7 +33,6 @@ func scripts_browser_modules_js() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/scripts/browser-modules.js"] = scripts_browser_modules_js
 }

+ 0 - 1
mod/dashboard/resources/scripts-browser-scripts.js.go

@@ -33,7 +33,6 @@ func scripts_browser_scripts_js() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/scripts/browser-scripts.js"] = scripts_browser_scripts_js
 }

+ 0 - 1
mod/dashboard/resources/scripts-stats-modules.js.go

@@ -33,7 +33,6 @@ func scripts_stats_modules_js() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/scripts/stats-modules.js"] = scripts_stats_modules_js
 }

+ 0 - 1
mod/dashboard/resources/scripts-stats-scripts.js.go

@@ -33,7 +33,6 @@ func scripts_stats_scripts_js() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/scripts/stats-scripts.js"] = scripts_stats_scripts_js
 }

+ 0 - 1
mod/dashboard/resources/stats.html.go

@@ -33,7 +33,6 @@ func stats_html() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/stats.html"] = stats_html
 }

+ 0 - 1
mod/dashboard/resources/styles-main.css.go

@@ -33,7 +33,6 @@ func styles_main_css() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/styles/main.css"] = styles_main_css
 }

+ 0 - 1
mod/dashboard/resources/views-browser.html.go

@@ -33,7 +33,6 @@ func views_browser_html() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/views/browser.html"] = views_browser_html
 }

+ 0 - 1
mod/dashboard/resources/views-stats.html.go

@@ -33,7 +33,6 @@ func views_stats_html() []byte {
 	return buf.Bytes()
 }
 
-
 func init() {
 	go_bindata["/views/stats.html"] = views_stats_html
 }

+ 1 - 1
mod/leader/v2/delete_handler.go

@@ -6,8 +6,8 @@ import (
 	"net/http"
 	"net/url"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // deleteHandler remove a given leader.

+ 1 - 1
mod/leader/v2/get_handler.go

@@ -5,7 +5,7 @@ import (
 	"io"
 	"net/http"
 
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // getHandler retrieves the current leader.

+ 9 - 9
mod/leader/v2/handler.go

@@ -3,8 +3,8 @@ package v2
 import (
 	"net/http"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // prefix is appended to the lock's prefix since the leader mod uses the lock mod.
@@ -13,19 +13,19 @@ const prefix = "/_mod/leader"
 // handler manages the leader HTTP request.
 type handler struct {
 	*mux.Router
-	client *http.Client
-	transport *http.Transport
-	addr string
+	client		*http.Client
+	transport	*http.Transport
+	addr		string
 }
 
 // NewHandler creates an HTTP handler that can be registered on a router.
-func NewHandler(addr string) (http.Handler) {
+func NewHandler(addr string) http.Handler {
 	transport := &http.Transport{DisableKeepAlives: false}
 	h := &handler{
-		Router: mux.NewRouter(),
-		client: &http.Client{Transport: transport},
-		transport: transport,
-		addr: addr,
+		Router:		mux.NewRouter(),
+		client:		&http.Client{Transport: transport},
+		transport:	transport,
+		addr:		addr,
 	}
 	h.StrictSlash(false)
 	h.handleFunc("/{key:.*}", h.getHandler).Methods("GET")

+ 1 - 1
mod/leader/v2/set_handler.go

@@ -6,8 +6,8 @@ import (
 	"net/http"
 	"net/url"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // setHandler attempts to set the current leader.

+ 1 - 3
mod/leader/v2/tests/mod_leader_test.go

@@ -7,7 +7,7 @@ import (
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensure that a leader can be set and read.
@@ -66,8 +66,6 @@ func TestModLeaderRenew(t *testing.T) {
 	})
 }
 
-
-
 func testSetLeader(s *server.Server, key string, name string, ttl int) (string, int, error) {
 	resp, err := tests.PutForm(fmt.Sprintf("%s/mod/v2/leader/%s?name=%s&ttl=%d", s.URL(), key, name, ttl), nil)
 	ret := tests.ReadBody(resp)

+ 7 - 7
mod/lock/v2/acquire_handler.go

@@ -8,9 +8,9 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/gorilla/mux"
-	"github.com/coreos/go-etcd/etcd"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // acquireHandler attempts to acquire a lock on the given key.
@@ -75,7 +75,7 @@ func (h *handler) acquireHandler(w http.ResponseWriter, req *http.Request) error
 }
 
 // createNode creates a new lock node and watches it until it is acquired or acquisition fails.
-func (h *handler) createNode(keypath string, value string, ttl int, closeChan <- chan bool, stopChan chan bool) (int, error) {
+func (h *handler) createNode(keypath string, value string, ttl int, closeChan <-chan bool, stopChan chan bool) (int, error) {
 	// Default the value to "-" if it is blank.
 	if len(value) == 0 {
 		value = "-"
@@ -133,7 +133,7 @@ func (h *handler) findExistingNode(keypath string, value string) (*etcd.Node, in
 func (h *handler) ttlKeepAlive(k string, value string, ttl int, stopChan chan bool) {
 	for {
 		select {
-		case <-time.After(time.Duration(ttl / 2) * time.Second):
+		case <-time.After(time.Duration(ttl/2) * time.Second):
 			h.client.Update(k, value, uint64(ttl))
 		case <-stopChan:
 			return
@@ -143,14 +143,14 @@ func (h *handler) ttlKeepAlive(k string, value string, ttl int, stopChan chan bo
 
 // watch continuously waits for a given lock index to be acquired or until lock fails.
 // Returns a boolean indicating success.
-func (h *handler) watch(keypath string, index int, closeChan <- chan bool) error {
+func (h *handler) watch(keypath string, index int, closeChan <-chan bool) error {
 	// Wrap close chan so we can pass it to Client.Watch().
 	stopWatchChan := make(chan bool)
 	go func() {
 		select {
-		case <- closeChan:
+		case <-closeChan:
 			stopWatchChan <- true
-		case <- stopWatchChan:
+		case <-stopWatchChan:
 		}
 	}()
 	defer close(stopWatchChan)

+ 1 - 1
mod/lock/v2/get_index_handler.go

@@ -4,8 +4,8 @@ import (
 	"net/http"
 	"path"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // getIndexHandler retrieves the current lock index.

+ 6 - 6
mod/lock/v2/handler.go

@@ -3,9 +3,9 @@ package v2
 import (
 	"net/http"
 
-	"github.com/gorilla/mux"
-	"github.com/coreos/go-etcd/etcd"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 const prefix = "/_etcd/mod/lock"
@@ -13,14 +13,14 @@ const prefix = "/_etcd/mod/lock"
 // handler manages the lock HTTP request.
 type handler struct {
 	*mux.Router
-	client *etcd.Client
+	client	*etcd.Client
 }
 
 // NewHandler creates an HTTP handler that can be registered on a router.
-func NewHandler(addr string) (http.Handler) {
+func NewHandler(addr string) http.Handler {
 	h := &handler{
-		Router: mux.NewRouter(),
-		client: etcd.NewClient([]string{addr}),
+		Router:	mux.NewRouter(),
+		client:	etcd.NewClient([]string{addr}),
 	}
 	h.StrictSlash(false)
 	h.handleFunc("/{key:.*}", h.getIndexHandler).Methods("GET")

+ 1 - 1
mod/lock/v2/lock_nodes.go

@@ -5,7 +5,7 @@ import (
 	"sort"
 	"strconv"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // lockNodes is a wrapper for go-etcd's Nodes to allow for sorting by numeric key.

+ 2 - 3
mod/lock/v2/release_handler.go

@@ -1,11 +1,11 @@
 package v2
 
 import (
-	"path"
 	"net/http"
+	"path"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // releaseLockHandler deletes the lock.
@@ -45,4 +45,3 @@ func (h *handler) releaseLockHandler(w http.ResponseWriter, req *http.Request) e
 
 	return nil
 }
-

+ 2 - 2
mod/lock/v2/renew_handler.go

@@ -1,12 +1,12 @@
 package v2
 
 import (
-	"path"
 	"net/http"
+	"path"
 	"strconv"
 
-	"github.com/gorilla/mux"
 	etcdErr "github.com/coreos/etcd/error"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // renewLockHandler attempts to update the TTL on an existing lock.

+ 5 - 7
mod/lock/v2/tests/mod_lock_test.go

@@ -7,7 +7,7 @@ import (
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensure that a lock can be acquired and released.
@@ -52,7 +52,7 @@ func TestModLockBlockUntilAcquire(t *testing.T) {
 			assert.Equal(t, body, "2")
 			c <- true
 		}()
-		<- c
+		<-c
 
 		// Acquire lock #2.
 		waiting := true
@@ -64,7 +64,7 @@ func TestModLockBlockUntilAcquire(t *testing.T) {
 			assert.Equal(t, body, "4")
 			waiting = false
 		}()
-		<- c
+		<-c
 
 		time.Sleep(1 * time.Second)
 
@@ -114,7 +114,7 @@ func TestModLockExpireAndRelease(t *testing.T) {
 			assert.Equal(t, body, "2")
 			c <- true
 		}()
-		<- c
+		<-c
 
 		// Acquire lock #2.
 		go func() {
@@ -124,7 +124,7 @@ func TestModLockExpireAndRelease(t *testing.T) {
 			assert.Equal(t, status, 200)
 			assert.Equal(t, body, "4")
 		}()
-		<- c
+		<-c
 
 		time.Sleep(1 * time.Second)
 
@@ -215,8 +215,6 @@ func TestModLockAcquireAndReleaseByValue(t *testing.T) {
 	})
 }
 
-
-
 func testAcquireLock(s *server.Server, key string, value string, ttl int) (string, int, error) {
 	resp, err := tests.PostForm(fmt.Sprintf("%s/mod/v2/lock/%s?value=%s&ttl=%d", s.URL(), key, value, ttl), nil)
 	ret := tests.ReadBody(resp)

+ 3 - 3
mod/mod.go

@@ -6,15 +6,15 @@ import (
 	"path"
 
 	"github.com/coreos/etcd/mod/dashboard"
-	lock2 "github.com/coreos/etcd/mod/lock/v2"
 	leader2 "github.com/coreos/etcd/mod/leader/v2"
-	"github.com/gorilla/mux"
+	lock2 "github.com/coreos/etcd/mod/lock/v2"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 var ServeMux *http.Handler
 
 func addSlash(w http.ResponseWriter, req *http.Request) {
-	http.Redirect(w, req, path.Join("mod", req.URL.Path) + "/", 302)
+	http.Redirect(w, req, path.Join("mod", req.URL.Path)+"/", 302)
 	return
 }
 

+ 60 - 60
server/config.go

@@ -13,7 +13,7 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/BurntSushi/toml"
+	"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"
 	"github.com/coreos/etcd/log"
 )
 
@@ -22,63 +22,63 @@ const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"
 
 // A lookup of deprecated flags to their new flag name.
 var newFlagNameLookup = map[string]string{
-	"C":             "peers",
-	"CF":            "peers-file",
-	"n":             "name",
-	"c":             "addr",
-	"cl":            "bind-addr",
-	"s":             "peer-addr",
-	"sl":            "peer-bind-addr",
-	"d":             "data-dir",
-	"m":             "max-result-buffer",
-	"r":             "max-retry-attempts",
-	"maxsize":       "max-cluster-size",
-	"clientCAFile":  "ca-file",
-	"clientCert":    "cert-file",
-	"clientKey":     "key-file",
-	"serverCAFile":  "peer-ca-file",
-	"serverCert":    "peer-cert-file",
-	"serverKey":     "peer-key-file",
-	"snapshotCount": "snapshot-count",
+	"C":			"peers",
+	"CF":			"peers-file",
+	"n":			"name",
+	"c":			"addr",
+	"cl":			"bind-addr",
+	"s":			"peer-addr",
+	"sl":			"peer-bind-addr",
+	"d":			"data-dir",
+	"m":			"max-result-buffer",
+	"r":			"max-retry-attempts",
+	"maxsize":		"max-cluster-size",
+	"clientCAFile":		"ca-file",
+	"clientCert":		"cert-file",
+	"clientKey":		"key-file",
+	"serverCAFile":		"peer-ca-file",
+	"serverCert":		"peer-cert-file",
+	"serverKey":		"peer-key-file",
+	"snapshotCount":	"snapshot-count",
 }
 
 // Config represents the server configuration.
 type Config struct {
-	SystemPath string
-
-	Addr             string `toml:"addr" env:"ETCD_ADDR"`
-	BindAddr         string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
-	CAFile           string `toml:"ca_file" env:"ETCD_CA_FILE"`
-	CertFile         string `toml:"cert_file" env:"ETCD_CERT_FILE"`
-	CPUProfileFile   string
-	CorsOrigins      []string `toml:"cors" env:"ETCD_CORS"`
-	DataDir          string   `toml:"data_dir" env:"ETCD_DATA_DIR"`
-	Force            bool
-	KeyFile          string   `toml:"key_file" env:"ETCD_KEY_FILE"`
-	Peers            []string `toml:"peers" env:"ETCD_PEERS"`
-	PeersFile        string   `toml:"peers_file" env:"ETCD_PEERS_FILE"`
-	MaxClusterSize   int      `toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
-	MaxResultBuffer  int      `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
-	MaxRetryAttempts int      `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
-	Name             string   `toml:"name" env:"ETCD_NAME"`
-	Snapshot         bool     `toml:"snapshot" env:"ETCD_SNAPSHOT"`
-	SnapshotCount    int      `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
-	ShowHelp         bool
-	ShowVersion      bool
-	Verbose          bool `toml:"verbose" env:"ETCD_VERBOSE"`
-	VeryVerbose      bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
-	VeryVeryVerbose  bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
-	Peer             struct {
-		Addr             string `toml:"addr" env:"ETCD_PEER_ADDR"`
-		BindAddr         string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
-		CAFile           string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
-		CertFile         string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
-		KeyFile          string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
-		HeartbeatTimeout int    `toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
-		ElectionTimeout  int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
-	}
-	strTrace     string `toml:"trace" env:"ETCD_TRACE"`
-	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
+	SystemPath	string
+
+	Addr			string	`toml:"addr" env:"ETCD_ADDR"`
+	BindAddr		string	`toml:"bind_addr" env:"ETCD_BIND_ADDR"`
+	CAFile			string	`toml:"ca_file" env:"ETCD_CA_FILE"`
+	CertFile		string	`toml:"cert_file" env:"ETCD_CERT_FILE"`
+	CPUProfileFile		string
+	CorsOrigins		[]string	`toml:"cors" env:"ETCD_CORS"`
+	DataDir			string		`toml:"data_dir" env:"ETCD_DATA_DIR"`
+	Force			bool
+	KeyFile			string		`toml:"key_file" env:"ETCD_KEY_FILE"`
+	Peers			[]string	`toml:"peers" env:"ETCD_PEERS"`
+	PeersFile		string		`toml:"peers_file" env:"ETCD_PEERS_FILE"`
+	MaxClusterSize		int		`toml:"max_cluster_size" env:"ETCD_MAX_CLUSTER_SIZE"`
+	MaxResultBuffer		int		`toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
+	MaxRetryAttempts	int		`toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
+	Name			string		`toml:"name" env:"ETCD_NAME"`
+	Snapshot		bool		`toml:"snapshot" env:"ETCD_SNAPSHOT"`
+	SnapshotCount		int		`toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
+	ShowHelp		bool
+	ShowVersion		bool
+	Verbose			bool	`toml:"verbose" env:"ETCD_VERBOSE"`
+	VeryVerbose		bool	`toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
+	VeryVeryVerbose		bool	`toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
+	Peer			struct {
+		Addr			string	`toml:"addr" env:"ETCD_PEER_ADDR"`
+		BindAddr		string	`toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
+		CAFile			string	`toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
+		CertFile		string	`toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
+		KeyFile			string	`toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
+		HeartbeatTimeout	int	`toml:"heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
+		ElectionTimeout		int	`toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
+	}
+	strTrace	string	`toml:"trace" env:"ETCD_TRACE"`
+	GraphiteHost	string	`toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
 }
 
 // NewConfig returns a Config initialized with default values.
@@ -433,9 +433,9 @@ func (c *Config) Sanitize() error {
 // TLSInfo retrieves a TLSInfo object for the client server.
 func (c *Config) TLSInfo() TLSInfo {
 	return TLSInfo{
-		CAFile:   c.CAFile,
-		CertFile: c.CertFile,
-		KeyFile:  c.KeyFile,
+		CAFile:		c.CAFile,
+		CertFile:	c.CertFile,
+		KeyFile:	c.KeyFile,
 	}
 }
 
@@ -447,9 +447,9 @@ func (c *Config) TLSConfig() (TLSConfig, error) {
 // PeerTLSInfo retrieves a TLSInfo object for the peer server.
 func (c *Config) PeerTLSInfo() TLSInfo {
 	return TLSInfo{
-		CAFile:   c.Peer.CAFile,
-		CertFile: c.Peer.CertFile,
-		KeyFile:  c.Peer.KeyFile,
+		CAFile:		c.Peer.CAFile,
+		CertFile:	c.Peer.CertFile,
+		KeyFile:	c.Peer.KeyFile,
 	}
 }
 

+ 2 - 2
server/config_test.go

@@ -5,8 +5,8 @@ import (
 	"os"
 	"testing"
 
-	"github.com/BurntSushi/toml"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensures that a configuration can be deserialized from TOML.

+ 11 - 11
server/join_command.go

@@ -5,7 +5,7 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -14,20 +14,20 @@ func init() {
 
 // The JoinCommand adds a node to the cluster.
 type JoinCommand struct {
-	MinVersion int    `json:"minVersion"`
-	MaxVersion int    `json:"maxVersion"`
-	Name       string `json:"name"`
-	RaftURL    string `json:"raftURL"`
-	EtcdURL    string `json:"etcdURL"`
+	MinVersion	int	`json:"minVersion"`
+	MaxVersion	int	`json:"maxVersion"`
+	Name		string	`json:"name"`
+	RaftURL		string	`json:"raftURL"`
+	EtcdURL		string	`json:"etcdURL"`
 }
 
 func NewJoinCommand(minVersion int, maxVersion int, name, raftUrl, etcdUrl string) *JoinCommand {
 	return &JoinCommand{
-		MinVersion: minVersion,
-		MaxVersion: maxVersion,
-		Name:       name,
-		RaftURL:    raftUrl,
-		EtcdURL:    etcdUrl,
+		MinVersion:	minVersion,
+		MaxVersion:	maxVersion,
+		Name:		name,
+		RaftURL:	raftUrl,
+		EtcdURL:	etcdUrl,
 	}
 }
 

+ 35 - 35
server/peer_server.go

@@ -11,8 +11,8 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
@@ -25,55 +25,55 @@ const retryInterval = 10
 const ThresholdMonitorTimeout = 5 * time.Second
 
 type PeerServerConfig struct {
-	Name             string
-	Scheme           string
-	URL              string
-	SnapshotCount    int
-	MaxClusterSize   int
-	RetryTimes       int
+	Name		string
+	Scheme		string
+	URL		string
+	SnapshotCount	int
+	MaxClusterSize	int
+	RetryTimes	int
 }
 
 type PeerServer struct {
-	Config         PeerServerConfig
-	raftServer     raft.Server
-	server         *Server
-	joinIndex      uint64
-	followersStats *raftFollowersStats
-	serverStats    *raftServerStats
-	registry       *Registry
-	store          store.Store
-	snapConf       *snapshotConf
-
-	closeChan            chan bool
-	timeoutThresholdChan chan interface{}
-
-	metrics *metrics.Bucket
+	Config		PeerServerConfig
+	raftServer	raft.Server
+	server		*Server
+	joinIndex	uint64
+	followersStats	*raftFollowersStats
+	serverStats	*raftServerStats
+	registry	*Registry
+	store		store.Store
+	snapConf	*snapshotConf
+
+	closeChan		chan bool
+	timeoutThresholdChan	chan interface{}
+
+	metrics	*metrics.Bucket
 }
 
 // TODO: find a good policy to do snapshot
 type snapshotConf struct {
 	// Etcd will check if snapshot is need every checkingInterval
-	checkingInterval time.Duration
+	checkingInterval	time.Duration
 
 	// The index when the last snapshot happened
-	lastIndex uint64
+	lastIndex	uint64
 
 	// If the incremental number of index since the last snapshot
 	// exceeds the snapshot Threshold, etcd will do a snapshot
-	snapshotThr uint64
+	snapshotThr	uint64
 }
 
 func NewPeerServer(psConfig PeerServerConfig, registry *Registry, store store.Store, mb *metrics.Bucket, followersStats *raftFollowersStats, serverStats *raftServerStats) *PeerServer {
 	s := &PeerServer{
-		Config: psConfig,
-		registry: registry,
-		store:    store,
-		followersStats: followersStats,
-		serverStats: serverStats,
+		Config:		psConfig,
+		registry:	registry,
+		store:		store,
+		followersStats:	followersStats,
+		serverStats:	serverStats,
 
-		timeoutThresholdChan: make(chan interface{}, 1),
+		timeoutThresholdChan:	make(chan interface{}, 1),
 
-		metrics: mb,
+		metrics:	mb,
 	}
 
 	return s
@@ -81,10 +81,10 @@ func NewPeerServer(psConfig PeerServerConfig, registry *Registry, store store.St
 
 func (s *PeerServer) SetRaftServer(raftServer raft.Server) {
 	s.snapConf = &snapshotConf{
-		checkingInterval: time.Second * 3,
+		checkingInterval:	time.Second * 3,
 		// this is not accurate, we will update raft to provide an api
-		lastIndex:   raftServer.CommitIndex(),
-		snapshotThr: uint64(s.Config.SnapshotCount),
+		lastIndex:	raftServer.CommitIndex(),
+		snapshotThr:	uint64(s.Config.SnapshotCount),
 	}
 
 	raftServer.AddEventListener(raft.StateChangeEventType, s.raftEventLogger)

+ 2 - 2
server/peer_server_handlers.go

@@ -9,8 +9,8 @@ import (
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // Get all the current logs

+ 19 - 19
server/raft_server_stats.go

@@ -3,36 +3,36 @@ package server
 import (
 	"time"
 
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 type raftServerStats struct {
-	Name      string    `json:"name"`
-	State     string    `json:"state"`
-	StartTime time.Time `json:"startTime"`
+	Name		string		`json:"name"`
+	State		string		`json:"state"`
+	StartTime	time.Time	`json:"startTime"`
 
-	LeaderInfo struct {
-		Name      string `json:"leader"`
-		Uptime    string `json:"uptime"`
-		startTime time.Time
-	} `json:"leaderInfo"`
+	LeaderInfo	struct {
+		Name		string	`json:"leader"`
+		Uptime		string	`json:"uptime"`
+		startTime	time.Time
+	}	`json:"leaderInfo"`
 
-	RecvAppendRequestCnt uint64  `json:"recvAppendRequestCnt,"`
-	RecvingPkgRate       float64 `json:"recvPkgRate,omitempty"`
-	RecvingBandwidthRate float64 `json:"recvBandwidthRate,omitempty"`
+	RecvAppendRequestCnt	uint64	`json:"recvAppendRequestCnt,"`
+	RecvingPkgRate		float64	`json:"recvPkgRate,omitempty"`
+	RecvingBandwidthRate	float64	`json:"recvBandwidthRate,omitempty"`
 
-	SendAppendRequestCnt uint64  `json:"sendAppendRequestCnt"`
-	SendingPkgRate       float64 `json:"sendPkgRate,omitempty"`
-	SendingBandwidthRate float64 `json:"sendBandwidthRate,omitempty"`
+	SendAppendRequestCnt	uint64	`json:"sendAppendRequestCnt"`
+	SendingPkgRate		float64	`json:"sendPkgRate,omitempty"`
+	SendingBandwidthRate	float64	`json:"sendBandwidthRate,omitempty"`
 
-	sendRateQueue *statsQueue
-	recvRateQueue *statsQueue
+	sendRateQueue	*statsQueue
+	recvRateQueue	*statsQueue
 }
 
 func NewRaftServerStats(name string) *raftServerStats {
 	return &raftServerStats{
-		Name:      name,
-		StartTime: time.Now(),
+		Name:		name,
+		StartTime:	time.Now(),
 		sendRateQueue: &statsQueue{
 			back: -1,
 		},

+ 1 - 0
server/release_version.go

@@ -1,2 +1,3 @@
 package server
+
 const ReleaseVersion = "v0.2.1-pre"

+ 1 - 1
server/remove_command.go

@@ -5,7 +5,7 @@ import (
 	"os"
 
 	"github.com/coreos/etcd/log"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {

+ 17 - 17
server/server.go

@@ -8,8 +8,8 @@ import (
 	"strings"
 	"time"
 
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
@@ -23,26 +23,26 @@ import (
 
 // This is the default implementation of the Server interface.
 type Server struct {
-	Name       string
-	url        string
-	handler    http.Handler
-	peerServer *PeerServer
-	registry   *Registry
-	store      store.Store
-	metrics        *metrics.Bucket
-
-	trace          bool
+	Name		string
+	url		string
+	handler		http.Handler
+	peerServer	*PeerServer
+	registry	*Registry
+	store		store.Store
+	metrics		*metrics.Bucket
+
+	trace	bool
 }
 
 // Creates a new Server.
 func New(name, url string, peerServer *PeerServer, registry *Registry, store store.Store, mb *metrics.Bucket) *Server {
 	s := &Server{
-		Name:       name,
-		url:        url,
-		store:      store,
-		registry:   registry,
-		peerServer: peerServer,
-		metrics:     mb,
+		Name:		name,
+		url:		url,
+		store:		store,
+		registry:	registry,
+		peerServer:	peerServer,
+		metrics:	mb,
 	}
 
 	return s

+ 15 - 15
server/transporter.go

@@ -10,18 +10,18 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/log"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 // Transporter layer for communication between raft nodes
 type transporter struct {
-	requestTimeout time.Duration
-	followersStats *raftFollowersStats
-	serverStats    *raftServerStats
-	registry       *Registry
+	requestTimeout	time.Duration
+	followersStats	*raftFollowersStats
+	serverStats	*raftServerStats
+	registry	*Registry
 
-	client    *http.Client
-	transport *http.Transport
+	client		*http.Client
+	transport	*http.Transport
 }
 
 type dialer func(network, addr string) (net.Conn, error)
@@ -34,16 +34,16 @@ func NewTransporter(followersStats *raftFollowersStats, serverStats *raftServerS
 		Dial: func(network, addr string) (net.Conn, error) {
 			return net.DialTimeout(network, addr, dialTimeout)
 		},
-		ResponseHeaderTimeout: responseHeaderTimeout,
+		ResponseHeaderTimeout:	responseHeaderTimeout,
 	}
 
 	t := transporter{
-		client:         &http.Client{Transport: tr},
-		transport:      tr,
-		requestTimeout: requestTimeout,
-		followersStats: followersStats,
-		serverStats:    serverStats,
-		registry:       registry,
+		client:		&http.Client{Transport: tr},
+		transport:	tr,
+		requestTimeout:	requestTimeout,
+		followersStats:	followersStats,
+		serverStats:	serverStats,
+		registry:	registry,
 	}
 
 	return &t
@@ -73,7 +73,7 @@ func (t *transporter) SendAppendEntriesRequest(server raft.Server, peer *raft.Pe
 
 	thisFollowerStats, ok := t.followersStats.Followers[peer.Name]
 
-	if !ok { //this is the first time this follower has been seen
+	if !ok {	//this is the first time this follower has been seen
 		thisFollowerStats = &raftFollowerStats{}
 		thisFollowerStats.Latency.Minimum = 1 << 63
 		t.followersStats.Followers[peer.Name] = thisFollowerStats

+ 1 - 1
server/v1/delete_key_handler.go

@@ -1,7 +1,7 @@
 package v1
 
 import (
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 	"net/http"
 )
 

+ 1 - 1
server/v1/get_key_handler.go

@@ -4,7 +4,7 @@ import (
 	"encoding/json"
 	"net/http"
 
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // Retrieves the value for a given key.

+ 2 - 2
server/v1/set_key_handler.go

@@ -5,8 +5,8 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // Sets the value for a given key.

+ 1 - 1
server/v1/v1.go

@@ -2,7 +2,7 @@ package v1
 
 import (
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 	"net/http"
 )
 

+ 1 - 1
server/v1/watch_key_handler.go

@@ -6,7 +6,7 @@ import (
 	"strconv"
 
 	etcdErr "github.com/coreos/etcd/error"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 // Watches a given key prefix for changes.

+ 1 - 1
server/v2/delete_handler.go

@@ -5,7 +5,7 @@ import (
 	"strconv"
 
 	etcdErr "github.com/coreos/etcd/error"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 func DeleteHandler(w http.ResponseWriter, req *http.Request, s Server) error {

+ 2 - 2
server/v2/get_handler.go

@@ -9,8 +9,8 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/log"
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 func GetHandler(w http.ResponseWriter, req *http.Request, s Server) error {

+ 1 - 1
server/v2/post_handler.go

@@ -5,7 +5,7 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/store"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 func PostHandler(w http.ResponseWriter, req *http.Request, s Server) error {

+ 2 - 2
server/v2/put_handler.go

@@ -7,8 +7,8 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
-	"github.com/gorilla/mux"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/gorilla/mux"
 )
 
 func PutHandler(w http.ResponseWriter, req *http.Request, s Server) error {

+ 1 - 1
server/v2/tests/delete_handler_test.go

@@ -8,7 +8,7 @@ import (
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensures that a key is deleted.

+ 1 - 1
server/v2/tests/get_handler_test.go

@@ -9,7 +9,7 @@ import (
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensures that a value can be retrieve for a given key.

+ 2 - 2
server/v2/tests/post_handler_test.go

@@ -2,12 +2,12 @@ package v2
 
 import (
 	"fmt"
-	"testing"
 	"net/http"
+	"testing"
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensures a unique value is added to the key's children.

+ 1 - 1
server/v2/tests/put_handler_test.go

@@ -9,7 +9,7 @@ import (
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensures that a key is set to a given value.

+ 1 - 1
server/v2/v2.go

@@ -2,7 +2,7 @@ package v2
 
 import (
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 	"net/http"
 )
 

+ 1 - 1
store/command_factory.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 // A lookup of factories by version.

+ 1 - 1
store/stats_test.go

@@ -4,7 +4,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensure that a successful Get is recorded in the stats.

+ 1 - 1
store/store_test.go

@@ -21,7 +21,7 @@ import (
 	"time"
 
 	etcdErr "github.com/coreos/etcd/error"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensure that the store can retrieve an existing value.

+ 24 - 24
store/v2/command_factory.go

@@ -4,7 +4,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -28,59 +28,59 @@ func (f *CommandFactory) CreateUpgradeCommand() raft.Command {
 // CreateSetCommand creates a version 2 command to set a key to a given value in the store.
 func (f *CommandFactory) CreateSetCommand(key string, dir bool, value string, expireTime time.Time) raft.Command {
 	return &SetCommand{
-		Key:        key,
-		Value:      value,
-		ExpireTime: expireTime,
-		Dir:        dir,
+		Key:		key,
+		Value:		value,
+		ExpireTime:	expireTime,
+		Dir:		dir,
 	}
 }
 
 // CreateCreateCommand creates a version 2 command to create a new key in the store.
 func (f *CommandFactory) CreateCreateCommand(key string, dir bool, value string, expireTime time.Time, unique bool) raft.Command {
 	return &CreateCommand{
-		Key:        key,
-		Value:      value,
-		ExpireTime: expireTime,
-		Unique:     unique,
-		Dir:        dir,
+		Key:		key,
+		Value:		value,
+		ExpireTime:	expireTime,
+		Unique:		unique,
+		Dir:		dir,
 	}
 }
 
 // CreateUpdateCommand creates a version 2 command to update a key to a given value in the store.
 func (f *CommandFactory) CreateUpdateCommand(key string, value string, expireTime time.Time) raft.Command {
 	return &UpdateCommand{
-		Key:        key,
-		Value:      value,
-		ExpireTime: expireTime,
+		Key:		key,
+		Value:		value,
+		ExpireTime:	expireTime,
 	}
 }
 
 // CreateDeleteCommand creates a version 2 command to delete a key from the store.
 func (f *CommandFactory) CreateDeleteCommand(key string, dir, recursive bool) raft.Command {
 	return &DeleteCommand{
-		Key:       key,
-		Recursive: recursive,
-		Dir:       dir,
+		Key:		key,
+		Recursive:	recursive,
+		Dir:		dir,
 	}
 }
 
 // CreateCompareAndSwapCommand creates a version 2 command to conditionally set a key in the store.
 func (f *CommandFactory) CreateCompareAndSwapCommand(key string, value string, prevValue string, prevIndex uint64, expireTime time.Time) raft.Command {
 	return &CompareAndSwapCommand{
-		Key:        key,
-		Value:      value,
-		PrevValue:  prevValue,
-		PrevIndex:  prevIndex,
-		ExpireTime: expireTime,
+		Key:		key,
+		Value:		value,
+		PrevValue:	prevValue,
+		PrevIndex:	prevIndex,
+		ExpireTime:	expireTime,
 	}
 }
 
 // CreateCompareAndDeleteCommand creates a version 2 command to conditionally delete a key from the store.
 func (f *CommandFactory) CreateCompareAndDeleteCommand(key string, prevValue string, prevIndex uint64) raft.Command {
 	return &CompareAndDeleteCommand{
-		Key:       key,
-		PrevValue: prevValue,
-		PrevIndex: prevIndex,
+		Key:		key,
+		PrevValue:	prevValue,
+		PrevIndex:	prevIndex,
 	}
 }
 

+ 4 - 4
store/v2/compare_and_delete_command.go

@@ -3,7 +3,7 @@ package v2
 import (
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -12,9 +12,9 @@ func init() {
 
 // The CompareAndDelete performs a conditional delete on a key in the store.
 type CompareAndDeleteCommand struct {
-	Key       string `json:"key"`
-	PrevValue string `json:"prevValue"`
-	PrevIndex uint64 `json:"prevIndex"`
+	Key		string	`json:"key"`
+	PrevValue	string	`json:"prevValue"`
+	PrevIndex	uint64	`json:"prevIndex"`
 }
 
 // The name of the compareAndDelete command in the log

+ 6 - 6
store/v2/compare_and_swap_command.go

@@ -5,7 +5,7 @@ import (
 
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -14,11 +14,11 @@ func init() {
 
 // The CompareAndSwap performs a conditional update on a key in the store.
 type CompareAndSwapCommand struct {
-	Key        string    `json:"key"`
-	Value      string    `json:"value"`
-	ExpireTime time.Time `json:"expireTime"`
-	PrevValue  string    `json:"prevValue"`
-	PrevIndex  uint64    `json:"prevIndex"`
+	Key		string		`json:"key"`
+	Value		string		`json:"value"`
+	ExpireTime	time.Time	`json:"expireTime"`
+	PrevValue	string		`json:"prevValue"`
+	PrevIndex	uint64		`json:"prevIndex"`
 }
 
 // The name of the testAndSet command in the log

+ 6 - 6
store/v2/create_command.go

@@ -5,7 +5,7 @@ import (
 
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -14,11 +14,11 @@ func init() {
 
 // Create command
 type CreateCommand struct {
-	Key        string    `json:"key"`
-	Value      string    `json:"value"`
-	ExpireTime time.Time `json:"expireTime"`
-	Unique     bool      `json:"unique"`
-	Dir        bool      `json:"dir"`
+	Key		string		`json:"key"`
+	Value		string		`json:"value"`
+	ExpireTime	time.Time	`json:"expireTime"`
+	Unique		bool		`json:"unique"`
+	Dir		bool		`json:"dir"`
 }
 
 // The name of the create command in the log

+ 4 - 4
store/v2/delete_command.go

@@ -3,7 +3,7 @@ package v2
 import (
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -12,9 +12,9 @@ func init() {
 
 // The DeleteCommand removes a key from the Store.
 type DeleteCommand struct {
-	Key       string `json:"key"`
-	Recursive bool   `json:"recursive"`
-	Dir       bool   `json:"dir"`
+	Key		string	`json:"key"`
+	Recursive	bool	`json:"recursive"`
+	Dir		bool	`json:"dir"`
 }
 
 // The name of the delete command in the log

+ 5 - 5
store/v2/set_command.go

@@ -5,7 +5,7 @@ import (
 
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {
@@ -14,10 +14,10 @@ func init() {
 
 // Create command
 type SetCommand struct {
-	Key        string    `json:"key"`
-	Value      string    `json:"value"`
-	ExpireTime time.Time `json:"expireTime"`
-	Dir        bool      `json:"dir"`
+	Key		string		`json:"key"`
+	Value		string		`json:"value"`
+	ExpireTime	time.Time	`json:"expireTime"`
+	Dir		bool		`json:"dir"`
 }
 
 // The name of the create command in the log

+ 1 - 1
store/v2/sync_command.go

@@ -4,7 +4,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 )
 
 func init() {

+ 4 - 4
store/v2/update_command.go

@@ -3,7 +3,7 @@ package v2
 import (
 	"github.com/coreos/etcd/log"
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 	"time"
 )
 
@@ -13,9 +13,9 @@ func init() {
 
 // Update command
 type UpdateCommand struct {
-	Key        string    `json:"key"`
-	Value      string    `json:"value"`
-	ExpireTime time.Time `json:"expireTime"`
+	Key		string		`json:"key"`
+	Value		string		`json:"value"`
+	ExpireTime	time.Time	`json:"expireTime"`
 }
 
 // The name of the update command in the log

+ 13 - 10
test.sh

@@ -1,15 +1,18 @@
 #!/bin/sh -e
-go run third_party.go test -i ./store
-go run third_party.go test -v ./store
 
-go run third_party.go test -i ./server
-go run third_party.go test -v ./server
+source ./build
 
-go run third_party.go test -i ./server/v2/tests
-go run third_party.go test -v ./server/v2/tests
+go test -i ./store
+go test -v ./store
 
-go run third_party.go test -i ./mod/lock/v2/tests
-go run third_party.go test -v ./mod/lock/v2/tests
+go test -i ./server
+go test -v ./server
 
-go run third_party.go test -i ./tests/functional
-ETCD_BIN_PATH=$(pwd)/bin/etcd go run third_party.go test -v ./tests/functional
+go test -i ./server/v2/tests
+go test -v ./server/v2/tests
+
+go test -i ./mod/lock/v2/tests
+go test -v ./mod/lock/v2/tests
+
+go test -i ./tests/functional
+ETCD_BIN_PATH=$(pwd)/bin/etcd go test -v ./tests/functional

+ 2 - 2
tests/functional/kill_random_test.go

@@ -51,7 +51,7 @@ func TestKillRandom(t *testing.T) {
 
 		}
 
-		for num, _ := range toKill {
+		for num := range toKill {
 			err := etcds[num].Kill()
 			if err != nil {
 				panic(err)
@@ -63,7 +63,7 @@ func TestKillRandom(t *testing.T) {
 
 		<-leaderChan
 
-		for num, _ := range toKill {
+		for num := range toKill {
 			etcds[num], err = os.StartProcess(EtcdBinPath, argGroup[num], procAttr)
 		}
 

+ 1 - 1
tests/functional/multi_node_kill_all_and_recovery_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // Create a five nodes

+ 1 - 1
tests/functional/multi_node_kill_one_test.go

@@ -7,7 +7,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // Create a five nodes

+ 1 - 1
tests/functional/remove_node_test.go

@@ -7,7 +7,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // remove the node and node rejoin with previous log

+ 1 - 1
tests/functional/simple_multi_node_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 func TestSimpleMultiNode(t *testing.T) {

+ 1 - 1
tests/functional/simple_snapshot_test.go

@@ -7,7 +7,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // This test creates a single node and then set a value to it to trigger snapshot

+ 1 - 1
tests/functional/single_node_recovery_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // This test creates a single node and then set a value to it.

+ 1 - 1
tests/functional/single_node_test.go

@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 )
 
 // Create a single node and try to set value

+ 2 - 2
tests/functional/util.go

@@ -18,7 +18,7 @@ package test
 
 import (
 	"fmt"
-	"github.com/coreos/go-etcd/etcd"
+	"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
 	"io/ioutil"
 	"net"
 	"net/http"
@@ -100,7 +100,7 @@ func CreateCluster(size int, procAttr *os.ProcAttr, ssl bool) ([][]string, []*os
 
 	etcds := make([]*os.Process, size)
 
-	for i, _ := range etcds {
+	for i := range etcds {
 		var err error
 		etcds[i], err = os.StartProcess(EtcdBinPath, append(argGroup[i], "-f"), procAttr)
 		if err != nil {

+ 1 - 1
tests/functional/v1_migration_test.go

@@ -11,7 +11,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/tests"
-	"github.com/stretchr/testify/assert"
+	"github.com/coreos/etcd/third_party/github.com/stretchr/testify/assert"
 )
 
 // Ensure that we can start a v2 node from the log of a v1 node.

+ 2 - 2
tests/mock/server_v2.go

@@ -4,14 +4,14 @@ import (
 	"net/http"
 
 	"github.com/coreos/etcd/store"
-	"github.com/coreos/go-raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 	"github.com/stretchr/testify/mock"
 )
 
 // A mock Server for the v2 handlers.
 type ServerV2 struct {
 	mock.Mock
-	store store.Store
+	store	store.Store
 }
 
 func NewServerV2(store store.Store) *ServerV2 {

+ 13 - 13
tests/server_utils.go

@@ -6,19 +6,19 @@ import (
 	"os"
 	"time"
 
-	"github.com/coreos/raft"
+	"github.com/coreos/etcd/third_party/github.com/coreos/raft"
 
 	"github.com/coreos/etcd/server"
 	"github.com/coreos/etcd/store"
 )
 
 const (
-	testName             = "ETCDTEST"
-	testClientURL        = "localhost:4401"
-	testRaftURL          = "localhost:7701"
-	testSnapshotCount    = 10000
-	testHeartbeatTimeout = time.Duration(50) * time.Millisecond
-	testElectionTimeout  = time.Duration(200) * time.Millisecond
+	testName		= "ETCDTEST"
+	testClientURL		= "localhost:4401"
+	testRaftURL		= "localhost:7701"
+	testSnapshotCount	= 10000
+	testHeartbeatTimeout	= time.Duration(50) * time.Millisecond
+	testElectionTimeout	= time.Duration(200) * time.Millisecond
 )
 
 // Starts a server in a temporary directory.
@@ -33,11 +33,11 @@ func RunServer(f func(*server.Server)) {
 	followersStats := server.NewRaftFollowersStats(testName)
 
 	psConfig := server.PeerServerConfig{
-		Name: testName,
-		URL: "http://"+testRaftURL,
-		Scheme: "http",
-		SnapshotCount: testSnapshotCount,
-		MaxClusterSize: 9,
+		Name:		testName,
+		URL:		"http://" + testRaftURL,
+		Scheme:		"http",
+		SnapshotCount:	testSnapshotCount,
+		MaxClusterSize:	9,
 	}
 	ps := server.NewPeerServer(psConfig, registry, store, nil, followersStats, serverStats)
 	psListener, err := server.NewListener(testRaftURL)
@@ -48,7 +48,7 @@ func RunServer(f func(*server.Server)) {
 	// Create Raft transporter and server
 	dialTimeout := (3 * testHeartbeatTimeout) + testElectionTimeout
 	responseHeaderTimeout := (3 * testHeartbeatTimeout) + testElectionTimeout
-	raftTransporter := server.NewTransporter(followersStats, serverStats, registry,	testHeartbeatTimeout, dialTimeout, responseHeaderTimeout)
+	raftTransporter := server.NewTransporter(followersStats, serverStats, registry, testHeartbeatTimeout, dialTimeout, responseHeaderTimeout)
 	raftServer, err := raft.NewServer(testName, path, raftTransporter, store, ps, "")
 	if err != nil {
 		panic(err)

+ 0 - 384
third_party.go

@@ -1,384 +0,0 @@
-// +build ignore
-
-/*
-Copyright 2013 Brandon Philips
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// This program builds a project and is a copy of third_party.go. See
-// github.com/philips/third_party.go
-//
-// $ go run third_party.go
-//
-// See the README file for more details.
-package main
-
-import (
-	"fmt"
-	"io"
-	"io/ioutil"
-	"log"
-	"os"
-	"os/exec"
-	"path"
-	"path/filepath"
-	"strings"
-)
-
-const (
-	DefaultThirdParty = "third_party"
-)
-
-// thirdPartyDir creates a string path to the third_party directory based on
-// the current working directory.
-func thirdPartyDir() string {
-	root, err := os.Getwd()
-	if err != nil {
-		log.Fatalf("Failed to get the current working directory: %v", err)
-	}
-	return path.Join(root, DefaultThirdParty)
-}
-
-func srcDir() string {
-	return path.Join(thirdPartyDir(), "src")
-}
-
-// binDir creates a string path to the GOBIN directory based on the current
-// working directory.
-func binDir() string {
-	root, err := os.Getwd()
-	if err != nil {
-		log.Fatalf("Failed to get the current working directory: %v", err)
-	}
-	return path.Join(root, "bin")
-}
-
-// run execs a command like a shell script piping everything to the parent's
-// stderr/stdout and uses the given environment.
-func run(name string, arg ...string) *os.ProcessState {
-	cmd := exec.Command(name, arg...)
-
-	stdout, err := cmd.StdoutPipe()
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-	stderr, err := cmd.StderrPipe()
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-	err = cmd.Start()
-	if err != nil {
-		fmt.Fprintf(os.Stderr, err.Error())
-		os.Exit(1)
-	}
-	go io.Copy(os.Stdout, stdout)
-	go io.Copy(os.Stderr, stderr)
-	cmd.Wait()
-
-	return cmd.ProcessState
-}
-
-// setupProject does the initial setup of the third_party src directory
-// including setting up the symlink to the cwd from the src directory.
-func setupProject(pkg string) {
-	root, err := os.Getwd()
-	if err != nil {
-		log.Fatalf("Failed to get the current working directory: %v", err)
-	}
-
-	src := path.Join(thirdPartyDir(), "src", pkg)
-	srcdir := path.Dir(src)
-
-	os.MkdirAll(srcdir, 0755)
-
-	rel, err := filepath.Rel(srcdir, root)
-	if err != nil {
-		log.Fatalf("creating relative third party path: %v", err)
-	}
-
-	err = os.Symlink(rel, src)
-	if err != nil && os.IsExist(err) == false {
-		log.Fatalf("creating project third party symlink: %v", err)
-	}
-}
-
-func getVc(root string) versionControl {
-	for _, v := range []string{".git", ".hg"} {
-		r := path.Join(root, v)
-		info, err := os.Stat(r)
-
-		if err != nil || !info.IsDir() {
-			continue
-		}
-
-		base := path.Base(r)
-		switch base {
-		case ".git":
-			return vcGit(r)
-		case ".hg":
-			return vcHg(r)
-		}
-	}
-	return new(vcNoop)
-}
-
-type versionControl interface {
-	commit() string
-	update(string) error
-}
-
-//  Performs noops on all VC operations.
-type vcNoop struct{}
-
-func (v *vcNoop) commit() string {
-	return ""
-}
-
-func (v *vcNoop) update(dir string) error {
-	return nil
-}
-
-type vcHg string
-
-// vcHg.commit returns the current HEAD commit hash for a given hg dir.
-func (v vcHg) commit() string {
-	out, err := exec.Command("hg", "id", "-i", "-R", string(v)).Output()
-	if err != nil {
-		return ""
-	}
-	return string(out)
-}
-
-// vcHg.udpate updates the given hg dir to ref.
-func (v vcHg) update(ref string) error {
-	_, err := exec.Command("hg",
-		"update",
-		"-r", ref,
-		"-R", string(v),
-		"--cwd", path.Dir(string(v)),
-	).Output()
-	if err != nil {
-		return err
-	}
-	return nil
-}
-
-type vcGit string
-
-// vcGit.commit returns the current HEAD commit hash for a given git dir.
-func (v vcGit) commit() string {
-	out, err := exec.Command("git", "--git-dir="+string(v), "rev-parse", "HEAD").Output()
-	if err != nil {
-		return ""
-	}
-	return string(out)
-}
-
-// vcHg.udpate updates the given git dir to ref.
-func (v vcGit) update(ref string) error {
-	_, err := exec.Command("git",
-		"--work-tree="+path.Dir(string(v)),
-		"--git-dir="+string(v),
-		"reset", "--hard", ref,
-	).Output()
-	if err != nil {
-		return err
-	}
-	return nil
-}
-
-// commit grabs the commit id from hg or git as a string.
-func commit(dir string) string {
-	return getVc(dir).commit()
-}
-
-// removeVcs removes a .git or .hg directory from the given root if it exists.
-func removeVcs(root string) (bool, string) {
-	for _, v := range []string{".git", ".hg"} {
-		r := path.Join(root, v)
-		info, err := os.Stat(r)
-
-		if err != nil {
-			continue
-		}
-
-		// We didn't find it, next!
-		if info.IsDir() == false {
-			continue
-		}
-
-		// We found it, grab the commit and remove the directory
-		c := commit(root)
-		err = os.RemoveAll(r)
-		if err != nil {
-			log.Fatalf("removeVcs: %v", err)
-		}
-		return true, c
-	}
-
-	return false, ""
-}
-
-// bump takes care of grabbing a package, getting the package git hash and
-// removing all of the version control stuff.
-func bump(pkg, version string) {
-	tpd := thirdPartyDir()
-
-	temp, err := ioutil.TempDir(tpd, "bump")
-	if err != nil {
-		log.Fatalf("bump: %v", err)
-	}
-	defer os.RemoveAll(temp)
-
-	os.Setenv("GOPATH", temp)
-	run("go", "get", "-u", "-d", pkg)
-
-	for {
-		root := path.Join(temp, "src", pkg) // the temp installation root
-		home := path.Join(tpd, "src", pkg)  // where the package will end up
-
-		if version != "" {
-			err := getVc(root).update(version)
-			if err != nil {
-				log.Fatalf("bump: %v", err)
-			}
-		}
-
-		ok, c := removeVcs(root)
-		if ok {
-			// Create the path leading up to the package
-			err := os.MkdirAll(path.Dir(home), 0755)
-			if err != nil {
-				log.Fatalf("bump: %v", err)
-			}
-
-			// Remove anything that might have been there
-			err = os.RemoveAll(home)
-			if err != nil {
-				log.Fatalf("bump: %v", err)
-			}
-
-			// Finally move the package
-			err = os.Rename(root, home)
-			if err != nil {
-				log.Fatalf("bump: %v", err)
-			}
-
-			fmt.Printf("%s %s\n", pkg, strings.TrimSpace(c))
-			break
-		}
-
-		// Pop off and try to find this directory!
-		pkg = path.Dir(pkg)
-		if pkg == "." {
-			return
-		}
-	}
-}
-
-// validPkg uses go list to decide if the given path is a valid go package.
-// This is used by the bumpAll walk to bump all of the existing packages.
-func validPkg(pkg string) bool {
-	env := append(os.Environ(),
-	)
-	cmd := exec.Command("go", "list", pkg)
-	cmd.Env = env
-
-	out, err := cmd.Output()
-	if err != nil {
-		return false
-	}
-
-	if pkg == strings.TrimSpace(string(out)) {
-		return true
-	}
-
-	return false
-}
-
-// bumpWalk walks the third_party directory and bumps all of the packages that it finds.
-func bumpWalk(path string, info os.FileInfo, err error) error {
-	if err != nil {
-		return nil
-	}
-
-	// go packages are always directories
-	if info.IsDir() == false {
-		return nil
-	}
-
-	parts := strings.Split(path, srcDir()+"/")
-	if len(parts) == 1 {
-		return nil
-	}
-
-	pkg := parts[1]
-
-	if validPkg(pkg) == false {
-		return nil
-	}
-
-	bump(pkg, "")
-
-	return nil
-}
-
-func bumpAll() {
-	err := filepath.Walk(srcDir(), bumpWalk)
-	if err != nil {
-		log.Fatalf(err.Error())
-	}
-}
-
-func main() {
-	log.SetFlags(0)
-
-	// third_party manages GOPATH, no one else
-	os.Setenv("GOPATH", thirdPartyDir())
-	os.Setenv("GOBIN", binDir())
-
-	if len(os.Args) <= 1 {
-		log.Fatalf("No command")
-	}
-
-	cmd := os.Args[1]
-
-	if cmd == "setup" && len(os.Args) > 2 {
-		setupProject(os.Args[2])
-		return
-	}
-
-	if cmd == "bump" && len(os.Args) > 2 {
-		ref := ""
-		if len(os.Args) > 3 {
-			ref = os.Args[3]
-		}
-
-		bump(os.Args[2], ref)
-		return
-	}
-
-	if cmd == "bump-all" && len(os.Args) > 1 {
-		bumpAll()
-		return
-	}
-
-	ps := run("go", os.Args[1:]...)
-
-	if ps.Success() == false {
-		os.Exit(1)
-	}
-}

+ 0 - 11
third_party/README

@@ -1,11 +0,0 @@
-# Third Party Libraries
-
-The third_party directory has all of the dependencies needed to build
-etcd so that we can have a consistent build. `go get` should not be
-called at any point during the build process.
-
-## Usage
-
-To update all of the third party libraries call
-
-    ./update

+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/LICENSE → third_party/bitbucket.org/kardianos/osext/LICENSE


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext.go → third_party/bitbucket.org/kardianos/osext/osext.go


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext_plan9.go → third_party/bitbucket.org/kardianos/osext/osext_plan9.go


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext_procfs.go → third_party/bitbucket.org/kardianos/osext/osext_procfs.go


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext_sysctl.go → third_party/bitbucket.org/kardianos/osext/osext_sysctl.go


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext_test.go → third_party/bitbucket.org/kardianos/osext/osext_test.go


+ 0 - 0
third_party/src/bitbucket.org/kardianos/osext/osext_windows.go → third_party/bitbucket.org/kardianos/osext/osext_windows.go


+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/Makefile → third_party/code.google.com/p/goprotobuf/proto/Makefile


+ 316 - 316
third_party/src/code.google.com/p/goprotobuf/proto/all_test.go → third_party/code.google.com/p/goprotobuf/proto/all_test.go

@@ -44,7 +44,7 @@ import (
 	"time"
 
 	. "./testdata"
-	. "code.google.com/p/goprotobuf/proto"
+	. "github.com/coreos/etcd/third_party/code.google.com/p/goprotobuf/proto"
 )
 
 var globalO *Buffer
@@ -507,61 +507,61 @@ func TestReset(t *testing.T) {
 func TestEncodeDecode1(t *testing.T) {
 	pb := initGoTest(false)
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 0x20
-			"714000000000000000"+ // field 14, encoding 1, value 0x40
-			"78a019"+ // field 15, encoding 0, value 0xca0 = 3232
-			"8001c032"+ // field 16, encoding 0, value 0x1940 = 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2, string "string"
-			"b304"+ // field 70, encoding 3, start group
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // field 70, encoding 4, end group
-			"aa0605"+"6279746573"+ // field 101, encoding 2, string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f") // field 103, encoding 0, 0x7f zigzag64
+		"0807"+	// field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 0x20
+			"714000000000000000"+	// field 14, encoding 1, value 0x40
+			"78a019"+	// field 15, encoding 0, value 0xca0 = 3232
+			"8001c032"+	// field 16, encoding 0, value 0x1940 = 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2, string "string"
+			"b304"+	// field 70, encoding 3, start group
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// field 70, encoding 4, end group
+			"aa0605"+"6279746573"+	// field 101, encoding 2, string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f")	// field 103, encoding 0, 0x7f zigzag64
 }
 
 // All required fields set, defaults provided.
 func TestEncodeDecode2(t *testing.T) {
 	pb := initGoTest(true)
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 32
-			"714000000000000000"+ // field 14, encoding 1, value 64
-			"78a019"+ // field 15, encoding 0, value 3232
-			"8001c032"+ // field 16, encoding 0, value 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
-			"c00201"+ // field 40, encoding 0, value 1
-			"c80220"+ // field 41, encoding 0, value 32
-			"d00240"+ // field 42, encoding 0, value 64
-			"dd0240010000"+ // field 43, encoding 5, value 320
-			"e1028002000000000000"+ // field 44, encoding 1, value 640
-			"e8028019"+ // field 45, encoding 0, value 3200
-			"f0028032"+ // field 46, encoding 0, value 6400
-			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
-			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
-			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
-			"b304"+ // start group field 70 level 1
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // end group field 70 level 1
-			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
-			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
-			"90193f"+ // field 402, encoding 0, value 63
-			"98197f") // field 403, encoding 0, value 127
+		"0807"+	// field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 32
+			"714000000000000000"+	// field 14, encoding 1, value 64
+			"78a019"+	// field 15, encoding 0, value 3232
+			"8001c032"+	// field 16, encoding 0, value 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2 string "string"
+			"c00201"+	// field 40, encoding 0, value 1
+			"c80220"+	// field 41, encoding 0, value 32
+			"d00240"+	// field 42, encoding 0, value 64
+			"dd0240010000"+	// field 43, encoding 5, value 320
+			"e1028002000000000000"+	// field 44, encoding 1, value 640
+			"e8028019"+	// field 45, encoding 0, value 3200
+			"f0028032"+	// field 46, encoding 0, value 6400
+			"fd02e0659948"+	// field 47, encoding 5, value 314159.0
+			"81030000000050971041"+	// field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+	// field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+	// start group field 70 level 1
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// end group field 70 level 1
+			"aa0605"+"6279746573"+	// field 101, encoding 2 string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+	// field 103, encoding 0, 0x7f zigzag64
+			"8a1907"+"4269676e6f7365"+	// field 401, encoding 2, string "Bignose"
+			"90193f"+	// field 402, encoding 0, value 63
+			"98197f")	// field 403, encoding 0, value 127
 
 }
 
@@ -583,37 +583,37 @@ func TestEncodeDecode3(t *testing.T) {
 	pb.F_Sint64Defaulted = Int64(-64)
 
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 32
-			"714000000000000000"+ // field 14, encoding 1, value 64
-			"78a019"+ // field 15, encoding 0, value 3232
-			"8001c032"+ // field 16, encoding 0, value 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
-			"c00201"+ // field 40, encoding 0, value 1
-			"c80220"+ // field 41, encoding 0, value 32
-			"d00240"+ // field 42, encoding 0, value 64
-			"dd0240010000"+ // field 43, encoding 5, value 320
-			"e1028002000000000000"+ // field 44, encoding 1, value 640
-			"e8028019"+ // field 45, encoding 0, value 3200
-			"f0028032"+ // field 46, encoding 0, value 6400
-			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
-			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
-			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
-			"b304"+ // start group field 70 level 1
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // end group field 70 level 1
-			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
-			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
-			"90193f"+ // field 402, encoding 0, value 63
-			"98197f") // field 403, encoding 0, value 127
+		"0807"+	// field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 32
+			"714000000000000000"+	// field 14, encoding 1, value 64
+			"78a019"+	// field 15, encoding 0, value 3232
+			"8001c032"+	// field 16, encoding 0, value 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2 string "string"
+			"c00201"+	// field 40, encoding 0, value 1
+			"c80220"+	// field 41, encoding 0, value 32
+			"d00240"+	// field 42, encoding 0, value 64
+			"dd0240010000"+	// field 43, encoding 5, value 320
+			"e1028002000000000000"+	// field 44, encoding 1, value 640
+			"e8028019"+	// field 45, encoding 0, value 3200
+			"f0028032"+	// field 46, encoding 0, value 6400
+			"fd02e0659948"+	// field 47, encoding 5, value 314159.0
+			"81030000000050971041"+	// field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+	// field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+	// start group field 70 level 1
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// end group field 70 level 1
+			"aa0605"+"6279746573"+	// field 101, encoding 2 string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+	// field 103, encoding 0, 0x7f zigzag64
+			"8a1907"+"4269676e6f7365"+	// field 401, encoding 2, string "Bignose"
+			"90193f"+	// field 402, encoding 0, value 63
+			"98197f")	// field 403, encoding 0, value 127
 
 }
 
@@ -639,56 +639,56 @@ func TestEncodeDecode4(t *testing.T) {
 	pb.Optionalgroup = initGoTest_OptionalGroup()
 
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"1205"+"68656c6c6f"+ // field 2, encoding 2, string "hello"
-			"1807"+ // field 3, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"320d"+"0a056c6162656c120474797065"+ // field 6, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 32
-			"714000000000000000"+ // field 14, encoding 1, value 64
-			"78a019"+ // field 15, encoding 0, value 3232
-			"8001c032"+ // field 16, encoding 0, value 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
-			"f00101"+ // field 30, encoding 0, value 1
-			"f80120"+ // field 31, encoding 0, value 32
-			"800240"+ // field 32, encoding 0, value 64
-			"8d02a00c0000"+ // field 33, encoding 5, value 3232
-			"91024019000000000000"+ // field 34, encoding 1, value 6464
-			"9802a0dd13"+ // field 35, encoding 0, value 323232
-			"a002c0ba27"+ // field 36, encoding 0, value 646464
-			"ad0200000042"+ // field 37, encoding 5, value 32.0
-			"b1020000000000005040"+ // field 38, encoding 1, value 64.0
-			"ba0205"+"68656c6c6f"+ // field 39, encoding 2, string "hello"
-			"c00201"+ // field 40, encoding 0, value 1
-			"c80220"+ // field 41, encoding 0, value 32
-			"d00240"+ // field 42, encoding 0, value 64
-			"dd0240010000"+ // field 43, encoding 5, value 320
-			"e1028002000000000000"+ // field 44, encoding 1, value 640
-			"e8028019"+ // field 45, encoding 0, value 3200
-			"f0028032"+ // field 46, encoding 0, value 6400
-			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
-			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
-			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
-			"b304"+ // start group field 70 level 1
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // end group field 70 level 1
-			"d305"+ // start group field 90 level 1
-			"da0508"+"6f7074696f6e616c"+ // field 91, encoding 2, string "optional"
-			"d405"+ // end group field 90 level 1
-			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
-			"ea1207"+"4269676e6f7365"+ // field 301, encoding 2, string "Bignose"
-			"f0123f"+ // field 302, encoding 0, value 63
-			"f8127f"+ // field 303, encoding 0, value 127
-			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
-			"90193f"+ // field 402, encoding 0, value 63
-			"98197f") // field 403, encoding 0, value 127
+		"0807"+	// field 1, encoding 0, value 7
+			"1205"+"68656c6c6f"+	// field 2, encoding 2, string "hello"
+			"1807"+	// field 3, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"320d"+"0a056c6162656c120474797065"+	// field 6, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 32
+			"714000000000000000"+	// field 14, encoding 1, value 64
+			"78a019"+	// field 15, encoding 0, value 3232
+			"8001c032"+	// field 16, encoding 0, value 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2 string "string"
+			"f00101"+	// field 30, encoding 0, value 1
+			"f80120"+	// field 31, encoding 0, value 32
+			"800240"+	// field 32, encoding 0, value 64
+			"8d02a00c0000"+	// field 33, encoding 5, value 3232
+			"91024019000000000000"+	// field 34, encoding 1, value 6464
+			"9802a0dd13"+	// field 35, encoding 0, value 323232
+			"a002c0ba27"+	// field 36, encoding 0, value 646464
+			"ad0200000042"+	// field 37, encoding 5, value 32.0
+			"b1020000000000005040"+	// field 38, encoding 1, value 64.0
+			"ba0205"+"68656c6c6f"+	// field 39, encoding 2, string "hello"
+			"c00201"+	// field 40, encoding 0, value 1
+			"c80220"+	// field 41, encoding 0, value 32
+			"d00240"+	// field 42, encoding 0, value 64
+			"dd0240010000"+	// field 43, encoding 5, value 320
+			"e1028002000000000000"+	// field 44, encoding 1, value 640
+			"e8028019"+	// field 45, encoding 0, value 3200
+			"f0028032"+	// field 46, encoding 0, value 6400
+			"fd02e0659948"+	// field 47, encoding 5, value 314159.0
+			"81030000000050971041"+	// field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+	// field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+	// start group field 70 level 1
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// end group field 70 level 1
+			"d305"+	// start group field 90 level 1
+			"da0508"+"6f7074696f6e616c"+	// field 91, encoding 2, string "optional"
+			"d405"+	// end group field 90 level 1
+			"aa0605"+"6279746573"+	// field 101, encoding 2 string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+	// field 103, encoding 0, 0x7f zigzag64
+			"ea1207"+"4269676e6f7365"+	// field 301, encoding 2, string "Bignose"
+			"f0123f"+	// field 302, encoding 0, value 63
+			"f8127f"+	// field 303, encoding 0, value 127
+			"8a1907"+"4269676e6f7365"+	// field 401, encoding 2, string "Bignose"
+			"90193f"+	// field 402, encoding 0, value 63
+			"98197f")	// field 403, encoding 0, value 127
 
 }
 
@@ -712,71 +712,71 @@ func TestEncodeDecode5(t *testing.T) {
 	pb.Repeatedgroup = []*GoTest_RepeatedGroup{initGoTest_RepeatedGroup(), initGoTest_RepeatedGroup()}
 
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
-			"2a0d"+"0a056c6162656c120474797065"+ // field 5, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 32
-			"714000000000000000"+ // field 14, encoding 1, value 64
-			"78a019"+ // field 15, encoding 0, value 3232
-			"8001c032"+ // field 16, encoding 0, value 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
-			"a00100"+ // field 20, encoding 0, value 0
-			"a00101"+ // field 20, encoding 0, value 1
-			"a80120"+ // field 21, encoding 0, value 32
-			"a80121"+ // field 21, encoding 0, value 33
-			"b00140"+ // field 22, encoding 0, value 64
-			"b00141"+ // field 22, encoding 0, value 65
-			"bd01a00c0000"+ // field 23, encoding 5, value 3232
-			"bd01050d0000"+ // field 23, encoding 5, value 3333
-			"c1014019000000000000"+ // field 24, encoding 1, value 6464
-			"c101a519000000000000"+ // field 24, encoding 1, value 6565
-			"c801a0dd13"+ // field 25, encoding 0, value 323232
-			"c80195ac14"+ // field 25, encoding 0, value 333333
-			"d001c0ba27"+ // field 26, encoding 0, value 646464
-			"d001b58928"+ // field 26, encoding 0, value 656565
-			"dd0100000042"+ // field 27, encoding 5, value 32.0
-			"dd0100000442"+ // field 27, encoding 5, value 33.0
-			"e1010000000000005040"+ // field 28, encoding 1, value 64.0
-			"e1010000000000405040"+ // field 28, encoding 1, value 65.0
-			"ea0105"+"68656c6c6f"+ // field 29, encoding 2, string "hello"
-			"ea0106"+"7361696c6f72"+ // field 29, encoding 2, string "sailor"
-			"c00201"+ // field 40, encoding 0, value 1
-			"c80220"+ // field 41, encoding 0, value 32
-			"d00240"+ // field 42, encoding 0, value 64
-			"dd0240010000"+ // field 43, encoding 5, value 320
-			"e1028002000000000000"+ // field 44, encoding 1, value 640
-			"e8028019"+ // field 45, encoding 0, value 3200
-			"f0028032"+ // field 46, encoding 0, value 6400
-			"fd02e0659948"+ // field 47, encoding 5, value 314159.0
-			"81030000000050971041"+ // field 48, encoding 1, value 271828.0
-			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
-			"b304"+ // start group field 70 level 1
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // end group field 70 level 1
-			"8305"+ // start group field 80 level 1
-			"8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
-			"8405"+ // end group field 80 level 1
-			"8305"+ // start group field 80 level 1
-			"8a0508"+"7265706561746564"+ // field 81, encoding 2, string "repeated"
-			"8405"+ // end group field 80 level 1
-			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
-			"ca0c03"+"626967"+ // field 201, encoding 2, string "big"
-			"ca0c04"+"6e6f7365"+ // field 201, encoding 2, string "nose"
-			"d00c40"+ // field 202, encoding 0, value 32
-			"d00c3f"+ // field 202, encoding 0, value -32
-			"d80c8001"+ // field 203, encoding 0, value 64
-			"d80c7f"+ // field 203, encoding 0, value -64
-			"8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
-			"90193f"+ // field 402, encoding 0, value 63
-			"98197f") // field 403, encoding 0, value 127
+		"0807"+	// field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"2a0d"+"0a056c6162656c120474797065"+	// field 5, encoding 2 (GoTestField)
+			"2a0d"+"0a056c6162656c120474797065"+	// field 5, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 32
+			"714000000000000000"+	// field 14, encoding 1, value 64
+			"78a019"+	// field 15, encoding 0, value 3232
+			"8001c032"+	// field 16, encoding 0, value 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2 string "string"
+			"a00100"+	// field 20, encoding 0, value 0
+			"a00101"+	// field 20, encoding 0, value 1
+			"a80120"+	// field 21, encoding 0, value 32
+			"a80121"+	// field 21, encoding 0, value 33
+			"b00140"+	// field 22, encoding 0, value 64
+			"b00141"+	// field 22, encoding 0, value 65
+			"bd01a00c0000"+	// field 23, encoding 5, value 3232
+			"bd01050d0000"+	// field 23, encoding 5, value 3333
+			"c1014019000000000000"+	// field 24, encoding 1, value 6464
+			"c101a519000000000000"+	// field 24, encoding 1, value 6565
+			"c801a0dd13"+	// field 25, encoding 0, value 323232
+			"c80195ac14"+	// field 25, encoding 0, value 333333
+			"d001c0ba27"+	// field 26, encoding 0, value 646464
+			"d001b58928"+	// field 26, encoding 0, value 656565
+			"dd0100000042"+	// field 27, encoding 5, value 32.0
+			"dd0100000442"+	// field 27, encoding 5, value 33.0
+			"e1010000000000005040"+	// field 28, encoding 1, value 64.0
+			"e1010000000000405040"+	// field 28, encoding 1, value 65.0
+			"ea0105"+"68656c6c6f"+	// field 29, encoding 2, string "hello"
+			"ea0106"+"7361696c6f72"+	// field 29, encoding 2, string "sailor"
+			"c00201"+	// field 40, encoding 0, value 1
+			"c80220"+	// field 41, encoding 0, value 32
+			"d00240"+	// field 42, encoding 0, value 64
+			"dd0240010000"+	// field 43, encoding 5, value 320
+			"e1028002000000000000"+	// field 44, encoding 1, value 640
+			"e8028019"+	// field 45, encoding 0, value 3200
+			"f0028032"+	// field 46, encoding 0, value 6400
+			"fd02e0659948"+	// field 47, encoding 5, value 314159.0
+			"81030000000050971041"+	// field 48, encoding 1, value 271828.0
+			"8a0310"+"68656c6c6f2c2022776f726c6421220a"+	// field 49, encoding 2 string "hello, \"world!\"\n"
+			"b304"+	// start group field 70 level 1
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// end group field 70 level 1
+			"8305"+	// start group field 80 level 1
+			"8a0508"+"7265706561746564"+	// field 81, encoding 2, string "repeated"
+			"8405"+	// end group field 80 level 1
+			"8305"+	// start group field 80 level 1
+			"8a0508"+"7265706561746564"+	// field 81, encoding 2, string "repeated"
+			"8405"+	// end group field 80 level 1
+			"aa0605"+"6279746573"+	// field 101, encoding 2 string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+	// field 103, encoding 0, 0x7f zigzag64
+			"ca0c03"+"626967"+	// field 201, encoding 2, string "big"
+			"ca0c04"+"6e6f7365"+	// field 201, encoding 2, string "nose"
+			"d00c40"+	// field 202, encoding 0, value 32
+			"d00c3f"+	// field 202, encoding 0, value -32
+			"d80c8001"+	// field 203, encoding 0, value 64
+			"d80c7f"+	// field 203, encoding 0, value -64
+			"8a1907"+"4269676e6f7365"+	// field 401, encoding 2, string "Bignose"
+			"90193f"+	// field 402, encoding 0, value 63
+			"98197f")	// field 403, encoding 0, value 127
 
 }
 
@@ -796,43 +796,43 @@ func TestEncodeDecode6(t *testing.T) {
 	pb.F_Sint64RepeatedPacked = []int64{64, -64}
 
 	overify(t, pb,
-		"0807"+ // field 1, encoding 0, value 7
-			"220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
-			"5001"+ // field 10, encoding 0, value 1
-			"5803"+ // field 11, encoding 0, value 3
-			"6006"+ // field 12, encoding 0, value 6
-			"6d20000000"+ // field 13, encoding 5, value 32
-			"714000000000000000"+ // field 14, encoding 1, value 64
-			"78a019"+ // field 15, encoding 0, value 3232
-			"8001c032"+ // field 16, encoding 0, value 6464
-			"8d0100004a45"+ // field 17, encoding 5, value 3232.0
-			"9101000000000040b940"+ // field 18, encoding 1, value 6464.0
-			"9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
-			"9203020001"+ // field 50, encoding 2, 2 bytes, value 0, value 1
-			"9a03022021"+ // field 51, encoding 2, 2 bytes, value 32, value 33
-			"a203024041"+ // field 52, encoding 2, 2 bytes, value 64, value 65
-			"aa0308"+ // field 53, encoding 2, 8 bytes
-			"a00c0000050d0000"+ // value 3232, value 3333
-			"b20310"+ // field 54, encoding 2, 16 bytes
-			"4019000000000000a519000000000000"+ // value 6464, value 6565
-			"ba0306"+ // field 55, encoding 2, 6 bytes
-			"a0dd1395ac14"+ // value 323232, value 333333
-			"c20306"+ // field 56, encoding 2, 6 bytes
-			"c0ba27b58928"+ // value 646464, value 656565
-			"ca0308"+ // field 57, encoding 2, 8 bytes
-			"0000004200000442"+ // value 32.0, value 33.0
-			"d20310"+ // field 58, encoding 2, 16 bytes
-			"00000000000050400000000000405040"+ // value 64.0, value 65.0
-			"b304"+ // start group field 70 level 1
-			"ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
-			"b404"+ // end group field 70 level 1
-			"aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
-			"b0063f"+ // field 102, encoding 0, 0x3f zigzag32
-			"b8067f"+ // field 103, encoding 0, 0x7f zigzag64
-			"b21f02"+ // field 502, encoding 2, 2 bytes
-			"403f"+ // value 32, value -32
-			"ba1f03"+ // field 503, encoding 2, 3 bytes
-			"80017f") // value 64, value -64
+		"0807"+	// field 1, encoding 0, value 7
+			"220d"+"0a056c6162656c120474797065"+	// field 4, encoding 2 (GoTestField)
+			"5001"+	// field 10, encoding 0, value 1
+			"5803"+	// field 11, encoding 0, value 3
+			"6006"+	// field 12, encoding 0, value 6
+			"6d20000000"+	// field 13, encoding 5, value 32
+			"714000000000000000"+	// field 14, encoding 1, value 64
+			"78a019"+	// field 15, encoding 0, value 3232
+			"8001c032"+	// field 16, encoding 0, value 6464
+			"8d0100004a45"+	// field 17, encoding 5, value 3232.0
+			"9101000000000040b940"+	// field 18, encoding 1, value 6464.0
+			"9a0106"+"737472696e67"+	// field 19, encoding 2 string "string"
+			"9203020001"+	// field 50, encoding 2, 2 bytes, value 0, value 1
+			"9a03022021"+	// field 51, encoding 2, 2 bytes, value 32, value 33
+			"a203024041"+	// field 52, encoding 2, 2 bytes, value 64, value 65
+			"aa0308"+	// field 53, encoding 2, 8 bytes
+			"a00c0000050d0000"+	// value 3232, value 3333
+			"b20310"+	// field 54, encoding 2, 16 bytes
+			"4019000000000000a519000000000000"+	// value 6464, value 6565
+			"ba0306"+	// field 55, encoding 2, 6 bytes
+			"a0dd1395ac14"+	// value 323232, value 333333
+			"c20306"+	// field 56, encoding 2, 6 bytes
+			"c0ba27b58928"+	// value 646464, value 656565
+			"ca0308"+	// field 57, encoding 2, 8 bytes
+			"0000004200000442"+	// value 32.0, value 33.0
+			"d20310"+	// field 58, encoding 2, 16 bytes
+			"00000000000050400000000000405040"+	// value 64.0, value 65.0
+			"b304"+	// start group field 70 level 1
+			"ba0408"+"7265717569726564"+	// field 71, encoding 2, string "required"
+			"b404"+	// end group field 70 level 1
+			"aa0605"+"6279746573"+	// field 101, encoding 2 string "bytes"
+			"b0063f"+	// field 102, encoding 0, 0x3f zigzag32
+			"b8067f"+	// field 103, encoding 0, 0x7f zigzag64
+			"b21f02"+	// field 502, encoding 2, 2 bytes
+			"403f"+	// value 32, value -32
+			"ba1f03"+	// field 503, encoding 2, 3 bytes
+			"80017f")	// value 64, value -64
 }
 
 // Test that we can encode empty bytes fields.
@@ -898,13 +898,13 @@ func TestSkippingUnrecognizedFields(t *testing.T) {
 
 	// Now new a GoSkipTest record.
 	skip := &GoSkipTest{
-		SkipInt32:   Int32(32),
-		SkipFixed32: Uint32(3232),
-		SkipFixed64: Uint64(6464),
-		SkipString:  String("skipper"),
+		SkipInt32:	Int32(32),
+		SkipFixed32:	Uint32(3232),
+		SkipFixed64:	Uint64(6464),
+		SkipString:	String("skipper"),
 		Skipgroup: &GoSkipTest_SkipGroup{
-			GroupInt32:  Int32(75),
-			GroupString: String("wxyz"),
+			GroupInt32:	Int32(75),
+			GroupString:	String("wxyz"),
 		},
 	}
 
@@ -944,8 +944,8 @@ func TestSkippingUnrecognizedFields(t *testing.T) {
 func TestSubmessageUnrecognizedFields(t *testing.T) {
 	nm := &NewMessage{
 		Nested: &NewMessage_Nested{
-			Name:      String("Nigel"),
-			FoodGroup: String("carbs"),
+			Name:		String("Nigel"),
+			FoodGroup:	String("carbs"),
 		},
 	}
 	b, err := Marshal(nm)
@@ -960,9 +960,9 @@ func TestSubmessageUnrecognizedFields(t *testing.T) {
 	}
 	exp := &OldMessage{
 		Nested: &OldMessage_Nested{
-			Name: String("Nigel"),
+			Name:	String("Nigel"),
 			// normal protocol buffer users should not do this
-			XXX_unrecognized: []byte("\x12\x05carbs"),
+			XXX_unrecognized:	[]byte("\x12\x05carbs"),
 		},
 	}
 	if !Equal(om, exp) {
@@ -999,7 +999,7 @@ func TestBigRepeated(t *testing.T) {
 	pb := initGoTest(true)
 
 	// Create the arrays
-	const N = 50 // Internally the library starts much smaller.
+	const N = 50	// Internally the library starts much smaller.
 	pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
 	pb.F_Sint64Repeated = make([]int64, N)
 	pb.F_Sint32Repeated = make([]int32, N)
@@ -1047,7 +1047,7 @@ func TestBigRepeated(t *testing.T) {
 
 	// Check the checkable values
 	for i := uint64(0); i < N; i++ {
-		if pbd.Repeatedgroup[i] == nil { // TODO: more checking?
+		if pbd.Repeatedgroup[i] == nil {	// TODO: more checking?
 			t.Error("pbd.Repeatedgroup bad")
 		}
 		var x uint64
@@ -1099,7 +1099,7 @@ func TestBigRepeated(t *testing.T) {
 		if pbd.F_BoolRepeated[i] != (i%2 == 0) {
 			t.Error("pbd.F_BoolRepeated bad", x, i)
 		}
-		if pbd.RepeatedField[i] == nil { // TODO: more checking?
+		if pbd.RepeatedField[i] == nil {	// TODO: more checking?
 			t.Error("pbd.RepeatedField bad")
 		}
 	}
@@ -1159,8 +1159,8 @@ func TestProto1RepeatedGroup(t *testing.T) {
 	pb := &MessageList{
 		Message: []*MessageList_Message{
 			{
-				Name:  String("blah"),
-				Count: Int32(7),
+				Name:	String("blah"),
+				Count:	Int32(7),
 			},
 			// NOTE: pb.Message[1] is a nil
 			nil,
@@ -1240,9 +1240,9 @@ type NNIMessage struct {
 	nni nonNillableInt
 }
 
-func (*NNIMessage) Reset()         {}
-func (*NNIMessage) String() string { return "" }
-func (*NNIMessage) ProtoMessage()  {}
+func (*NNIMessage) Reset()		{}
+func (*NNIMessage) String() string	{ return "" }
+func (*NNIMessage) ProtoMessage()	{}
 
 // A type that implements the Marshaler interface and is nillable.
 type nillableMessage struct {
@@ -1257,9 +1257,9 @@ type NMMessage struct {
 	nm *nillableMessage
 }
 
-func (*NMMessage) Reset()         {}
-func (*NMMessage) String() string { return "" }
-func (*NMMessage) ProtoMessage()  {}
+func (*NMMessage) Reset()		{}
+func (*NMMessage) String() string	{ return "" }
+func (*NMMessage) ProtoMessage()	{}
 
 // Verify a type that uses the Marshaler interface, but has a nil pointer.
 func TestNilMarshaler(t *testing.T) {
@@ -1273,7 +1273,7 @@ func TestNilMarshaler(t *testing.T) {
 	// Try a struct with a Marshaler field that is not nillable.
 	nnim := new(NNIMessage)
 	nnim.nni = 7
-	var _ Marshaler = nnim.nni // verify it is truly a Marshaler
+	var _ Marshaler = nnim.nni	// verify it is truly a Marshaler
 	if _, err := Marshal(nnim); err != nil {
 		t.Error("unexpected error marshaling nnim: ", err)
 	}
@@ -1286,23 +1286,23 @@ func TestAllSetDefaults(t *testing.T) {
 		F_Nan: Float32(1.7),
 	}
 	expected := &Defaults{
-		F_Bool:    Bool(true),
-		F_Int32:   Int32(32),
-		F_Int64:   Int64(64),
-		F_Fixed32: Uint32(320),
-		F_Fixed64: Uint64(640),
-		F_Uint32:  Uint32(3200),
-		F_Uint64:  Uint64(6400),
-		F_Float:   Float32(314159),
-		F_Double:  Float64(271828),
-		F_String:  String(`hello, "world!"` + "\n"),
-		F_Bytes:   []byte("Bignose"),
-		F_Sint32:  Int32(-32),
-		F_Sint64:  Int64(-64),
-		F_Enum:    Defaults_GREEN.Enum(),
-		F_Pinf:    Float32(float32(math.Inf(1))),
-		F_Ninf:    Float32(float32(math.Inf(-1))),
-		F_Nan:     Float32(1.7),
+		F_Bool:		Bool(true),
+		F_Int32:	Int32(32),
+		F_Int64:	Int64(64),
+		F_Fixed32:	Uint32(320),
+		F_Fixed64:	Uint64(640),
+		F_Uint32:	Uint32(3200),
+		F_Uint64:	Uint64(6400),
+		F_Float:	Float32(314159),
+		F_Double:	Float64(271828),
+		F_String:	String(`hello, "world!"` + "\n"),
+		F_Bytes:	[]byte("Bignose"),
+		F_Sint32:	Int32(-32),
+		F_Sint64:	Int64(-64),
+		F_Enum:		Defaults_GREEN.Enum(),
+		F_Pinf:		Float32(float32(math.Inf(1))),
+		F_Ninf:		Float32(float32(math.Inf(-1))),
+		F_Nan:		Float32(1.7),
 	}
 	SetDefaults(m)
 	if !Equal(m, expected) {
@@ -1323,16 +1323,16 @@ func TestSetDefaultsWithSetField(t *testing.T) {
 
 func TestSetDefaultsWithSubMessage(t *testing.T) {
 	m := &OtherMessage{
-		Key: Int64(123),
+		Key:	Int64(123),
 		Inner: &InnerMessage{
 			Host: String("gopher"),
 		},
 	}
 	expected := &OtherMessage{
-		Key: Int64(123),
+		Key:	Int64(123),
 		Inner: &InnerMessage{
-			Host: String("gopher"),
-			Port: Int32(4000),
+			Host:	String("gopher"),
+			Port:	Int32(4000),
 		},
 	}
 	SetDefaults(m)
@@ -1375,12 +1375,12 @@ func TestMaximumTagNumber(t *testing.T) {
 
 func TestJSON(t *testing.T) {
 	m := &MyMessage{
-		Count: Int32(4),
-		Pet:   []string{"bunny", "kitty"},
+		Count:	Int32(4),
+		Pet:	[]string{"bunny", "kitty"},
 		Inner: &InnerMessage{
 			Host: String("cauchy"),
 		},
-		Bikeshed: MyMessage_GREEN.Enum(),
+		Bikeshed:	MyMessage_GREEN.Enum(),
 	}
 	const expected = `{"count":4,"pet":["bunny","kitty"],"inner":{"host":"cauchy"},"bikeshed":1}`
 
@@ -1413,7 +1413,7 @@ func TestJSON(t *testing.T) {
 }
 
 func TestBadWireType(t *testing.T) {
-	b := []byte{7<<3 | 6} // field 7, wire type 6
+	b := []byte{7<<3 | 6}	// field 7, wire type 6
 	pb := new(OtherMessage)
 	if err := Unmarshal(b, pb); err == nil {
 		t.Errorf("Unmarshal did not fail")
@@ -1610,10 +1610,10 @@ func TestUnmarshalMergesMessages(t *testing.T) {
 	// If a nested message occurs twice in the input,
 	// the fields should be merged when decoding.
 	a := &OtherMessage{
-		Key: Int64(123),
+		Key:	Int64(123),
 		Inner: &InnerMessage{
-			Host: String("polhode"),
-			Port: Int32(1234),
+			Host:	String("polhode"),
+			Port:	Int32(1234),
 		},
 	}
 	aData, err := Marshal(a)
@@ -1621,10 +1621,10 @@ func TestUnmarshalMergesMessages(t *testing.T) {
 		t.Fatalf("Marshal(a): %v", err)
 	}
 	b := &OtherMessage{
-		Weight: Float32(1.2),
+		Weight:	Float32(1.2),
 		Inner: &InnerMessage{
-			Host:      String("herpolhode"),
-			Connected: Bool(true),
+			Host:		String("herpolhode"),
+			Connected:	Bool(true),
 		},
 	}
 	bData, err := Marshal(b)
@@ -1632,12 +1632,12 @@ func TestUnmarshalMergesMessages(t *testing.T) {
 		t.Fatalf("Marshal(b): %v", err)
 	}
 	want := &OtherMessage{
-		Key:    Int64(123),
-		Weight: Float32(1.2),
+		Key:	Int64(123),
+		Weight:	Float32(1.2),
 		Inner: &InnerMessage{
-			Host:      String("herpolhode"),
-			Port:      Int32(1234),
-			Connected: Bool(true),
+			Host:		String("herpolhode"),
+			Port:		Int32(1234),
+			Connected:	Bool(true),
 		},
 	}
 	got := new(OtherMessage)
@@ -1651,8 +1651,8 @@ func TestUnmarshalMergesMessages(t *testing.T) {
 
 func TestEncodingSizes(t *testing.T) {
 	tests := []struct {
-		m Message
-		n int
+		m	Message
+		n	int
 	}{
 		{&Defaults{F_Int32: Int32(math.MaxInt32)}, 6},
 		{&Defaults{F_Int32: Int32(math.MinInt32)}, 6},
@@ -1676,22 +1676,22 @@ func TestRequiredNotSetError(t *testing.T) {
 	pb.F_Int32Required = nil
 	pb.F_Int64Required = nil
 
-	expected := "0807" + // field 1, encoding 0, value 7
-		"2206" + "120474797065" + // field 4, encoding 2 (GoTestField)
-		"5001" + // field 10, encoding 0, value 1
-		"6d20000000" + // field 13, encoding 5, value 0x20
-		"714000000000000000" + // field 14, encoding 1, value 0x40
-		"78a019" + // field 15, encoding 0, value 0xca0 = 3232
-		"8001c032" + // field 16, encoding 0, value 0x1940 = 6464
-		"8d0100004a45" + // field 17, encoding 5, value 3232.0
-		"9101000000000040b940" + // field 18, encoding 1, value 6464.0
-		"9a0106" + "737472696e67" + // field 19, encoding 2, string "string"
-		"b304" + // field 70, encoding 3, start group
-		"ba0408" + "7265717569726564" + // field 71, encoding 2, string "required"
-		"b404" + // field 70, encoding 4, end group
-		"aa0605" + "6279746573" + // field 101, encoding 2, string "bytes"
-		"b0063f" + // field 102, encoding 0, 0x3f zigzag32
-		"b8067f" // field 103, encoding 0, 0x7f zigzag64
+	expected := "0807" +	// field 1, encoding 0, value 7
+		"2206" + "120474797065" +	// field 4, encoding 2 (GoTestField)
+		"5001" +	// field 10, encoding 0, value 1
+		"6d20000000" +	// field 13, encoding 5, value 0x20
+		"714000000000000000" +	// field 14, encoding 1, value 0x40
+		"78a019" +	// field 15, encoding 0, value 0xca0 = 3232
+		"8001c032" +	// field 16, encoding 0, value 0x1940 = 6464
+		"8d0100004a45" +	// field 17, encoding 5, value 3232.0
+		"9101000000000040b940" +	// field 18, encoding 1, value 6464.0
+		"9a0106" + "737472696e67" +	// field 19, encoding 2, string "string"
+		"b304" +	// field 70, encoding 3, start group
+		"ba0408" + "7265717569726564" +	// field 71, encoding 2, string "required"
+		"b404" +	// field 70, encoding 4, end group
+		"aa0605" + "6279746573" +	// field 101, encoding 2, string "bytes"
+		"b0063f" +	// field 102, encoding 0, 0x3f zigzag32
+		"b8067f"	// field 103, encoding 0, 0x7f zigzag64
 
 	o := old()
 	bytes, err := Marshal(pb)
@@ -1751,7 +1751,7 @@ func fuzzUnmarshal(t *testing.T, data []byte) {
 
 func testMsg() *GoTest {
 	pb := initGoTest(true)
-	const N = 1000 // Internally the library starts much smaller.
+	const N = 1000	// Internally the library starts much smaller.
 	pb.F_Int32Repeated = make([]int32, N)
 	pb.F_DoubleRepeated = make([]float64, N)
 	for i := 0; i < N; i++ {
@@ -1869,13 +1869,13 @@ func BenchmarkUnmarshalUnrecognizedFields(b *testing.B) {
 	b.StopTimer()
 	pb := initGoTestField()
 	skip := &GoSkipTest{
-		SkipInt32:   Int32(32),
-		SkipFixed32: Uint32(3232),
-		SkipFixed64: Uint64(6464),
-		SkipString:  String("skipper"),
+		SkipInt32:	Int32(32),
+		SkipFixed32:	Uint32(3232),
+		SkipFixed64:	Uint64(6464),
+		SkipString:	String("skipper"),
 		Skipgroup: &GoSkipTest_SkipGroup{
-			GroupInt32:  Int32(75),
-			GroupString: String("wxyz"),
+			GroupInt32:	Int32(75),
+			GroupString:	String("wxyz"),
 		},
 	}
 

+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/clone.go → third_party/code.google.com/p/goprotobuf/proto/clone.go


+ 22 - 22
third_party/src/code.google.com/p/goprotobuf/proto/clone_test.go → third_party/code.google.com/p/goprotobuf/proto/clone_test.go

@@ -34,19 +34,19 @@ package proto_test
 import (
 	"testing"
 
-	"code.google.com/p/goprotobuf/proto"
+	"github.com/coreos/etcd/third_party/code.google.com/p/goprotobuf/proto"
 
 	pb "./testdata"
 )
 
 var cloneTestMessage = &pb.MyMessage{
-	Count: proto.Int32(42),
-	Name:  proto.String("Dave"),
-	Pet:   []string{"bunny", "kitty", "horsey"},
+	Count:	proto.Int32(42),
+	Name:	proto.String("Dave"),
+	Pet:	[]string{"bunny", "kitty", "horsey"},
 	Inner: &pb.InnerMessage{
-		Host:      proto.String("niles"),
-		Port:      proto.Int32(9099),
-		Connected: proto.Bool(true),
+		Host:		proto.String("niles"),
+		Port:		proto.Int32(9099),
+		Connected:	proto.Bool(true),
 	},
 	Others: []*pb.OtherMessage{
 		{
@@ -56,7 +56,7 @@ var cloneTestMessage = &pb.MyMessage{
 	Somegroup: &pb.MyMessage_SomeGroup{
 		GroupField: proto.Int32(6),
 	},
-	RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
+	RepBytes:	[][]byte{[]byte("sham"), []byte("wow")},
 }
 
 func init() {
@@ -99,17 +99,17 @@ var mergeTests = []struct {
 			Name: proto.String("Dave"),
 		},
 		want: &pb.MyMessage{
-			Count: proto.Int32(42),
-			Name:  proto.String("Dave"),
+			Count:	proto.Int32(42),
+			Name:	proto.String("Dave"),
 		},
 	},
 	{
 		src: &pb.MyMessage{
 			Inner: &pb.InnerMessage{
-				Host:      proto.String("hey"),
-				Connected: proto.Bool(true),
+				Host:		proto.String("hey"),
+				Connected:	proto.Bool(true),
 			},
-			Pet: []string{"horsey"},
+			Pet:	[]string{"horsey"},
 			Others: []*pb.OtherMessage{
 				{
 					Value: []byte("some bytes"),
@@ -118,10 +118,10 @@ var mergeTests = []struct {
 		},
 		dst: &pb.MyMessage{
 			Inner: &pb.InnerMessage{
-				Host: proto.String("niles"),
-				Port: proto.Int32(9099),
+				Host:	proto.String("niles"),
+				Port:	proto.Int32(9099),
 			},
-			Pet: []string{"bunny", "kitty"},
+			Pet:	[]string{"bunny", "kitty"},
 			Others: []*pb.OtherMessage{
 				{
 					Key: proto.Int64(31415926535),
@@ -134,11 +134,11 @@ var mergeTests = []struct {
 		},
 		want: &pb.MyMessage{
 			Inner: &pb.InnerMessage{
-				Host:      proto.String("hey"),
-				Connected: proto.Bool(true),
-				Port:      proto.Int32(9099),
+				Host:		proto.String("hey"),
+				Connected:	proto.Bool(true),
+				Port:		proto.Int32(9099),
 			},
-			Pet: []string{"bunny", "kitty", "horsey"},
+			Pet:	[]string{"bunny", "kitty", "horsey"},
 			Others: []*pb.OtherMessage{
 				{
 					Key: proto.Int64(31415926535),
@@ -158,13 +158,13 @@ var mergeTests = []struct {
 			Somegroup: &pb.MyMessage_SomeGroup{
 				GroupField: proto.Int32(6),
 			},
-			RepBytes: [][]byte{[]byte("sham")},
+			RepBytes:	[][]byte{[]byte("sham")},
 		},
 		want: &pb.MyMessage{
 			Somegroup: &pb.MyMessage_SomeGroup{
 				GroupField: proto.Int32(6),
 			},
-			RepBytes: [][]byte{[]byte("sham"), []byte("wow")},
+			RepBytes:	[][]byte{[]byte("sham"), []byte("wow")},
 		},
 	},
 }

+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/decode.go → third_party/code.google.com/p/goprotobuf/proto/decode.go


+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/encode.go → third_party/code.google.com/p/goprotobuf/proto/encode.go


+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/equal.go → third_party/code.google.com/p/goprotobuf/proto/equal.go


+ 6 - 6
third_party/src/code.google.com/p/goprotobuf/proto/equal_test.go → third_party/code.google.com/p/goprotobuf/proto/equal_test.go

@@ -35,7 +35,7 @@ import (
 	"testing"
 
 	pb "./testdata"
-	. "code.google.com/p/goprotobuf/proto"
+	. "github.com/coreos/etcd/third_party/code.google.com/p/goprotobuf/proto"
 )
 
 // Four identical base messages.
@@ -85,9 +85,9 @@ func init() {
 }
 
 var EqualTests = []struct {
-	desc string
-	a, b Message
-	exp  bool
+	desc	string
+	a, b	Message
+	exp	bool
 }{
 	{"different types", &pb.GoEnum{}, &pb.GoTestField{}, false},
 	{"equal empty", &pb.GoEnum{}, &pb.GoEnum{}, true},
@@ -142,13 +142,13 @@ var EqualTests = []struct {
 	{
 		"message with group",
 		&pb.MyMessage{
-			Count: Int32(1),
+			Count:	Int32(1),
 			Somegroup: &pb.MyMessage_SomeGroup{
 				GroupField: Int32(5),
 			},
 		},
 		&pb.MyMessage{
-			Count: Int32(1),
+			Count:	Int32(1),
 			Somegroup: &pb.MyMessage_SomeGroup{
 				GroupField: Int32(5),
 			},

+ 0 - 0
third_party/src/code.google.com/p/goprotobuf/proto/extensions.go → third_party/code.google.com/p/goprotobuf/proto/extensions.go


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác