Browse Source

Merge pull request #4358 from gyuho/typo

*: fix minor typos, comments
Gyu-Ho Lee 10 years ago
parent
commit
42acd957a3
6 changed files with 13 additions and 9 deletions
  1. 1 0
      clientv3/client_test.go
  2. 1 0
      clientv3/txn.go
  3. 4 2
      pkg/types/urlsmap.go
  4. 1 1
      pkg/wait/wait_time.go
  5. 2 2
      raft/raft_test.go
  6. 4 4
      wal/wal.go

+ 1 - 0
clientv3/client_test.go

@@ -11,6 +11,7 @@
 // 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.
+
 package clientv3
 
 import (

+ 1 - 0
clientv3/txn.go

@@ -11,6 +11,7 @@
 // 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.
+
 package clientv3
 
 import (

+ 4 - 2
pkg/types/urlsmap.go

@@ -20,6 +20,7 @@ import (
 	"strings"
 )
 
+// URLsMap is a map from a name to its URLs.
 type URLsMap map[string]URLs
 
 // NewURLsMap returns a URLsMap instantiated from the given string,
@@ -41,7 +42,7 @@ func NewURLsMap(s string) (URLsMap, error) {
 
 // String returns NameURLPairs into discovery-formatted name-to-URLs sorted by name.
 func (c URLsMap) String() string {
-	pairs := make([]string, 0)
+	var pairs []string
 	for name, urls := range c {
 		for _, url := range urls {
 			pairs = append(pairs, fmt.Sprintf("%s=%s", name, url.String()))
@@ -54,7 +55,7 @@ func (c URLsMap) String() string {
 // URLs returns a list of all URLs.
 // The returned list is sorted in ascending lexicographical order.
 func (c URLsMap) URLs() []string {
-	urls := make([]string, 0)
+	var urls []string
 	for _, us := range c {
 		for _, u := range us {
 			urls = append(urls, u.String())
@@ -64,6 +65,7 @@ func (c URLsMap) URLs() []string {
 	return urls
 }
 
+// Len returns the size of URLsMap.
 func (c URLsMap) Len() int {
 	return len(c)
 }

+ 1 - 1
pkg/wait/wait_time.go

@@ -24,7 +24,7 @@ type WaitTime interface {
 	// The chan will be triggered when Trigger is called with a
 	// deadline that is later than the one it is waiting for.
 	// The given deadline MUST be unique. The deadline should be
-	// retrived by calling time.Now() in most cases.
+	// retrieved by calling time.Now() in most cases.
 	Wait(deadline time.Time) <-chan struct{}
 	// Trigger triggers all the waiting chans with an earlier deadline.
 	Trigger(deadline time.Time)

+ 2 - 2
raft/raft_test.go

@@ -237,7 +237,7 @@ func TestProgressIsPaused(t *testing.T) {
 			ins:    newInflights(256),
 		}
 		if g := p.isPaused(); g != tt.w {
-			t.Errorf("#%d: shouldwait = %t, want %t", i, g, tt.w)
+			t.Errorf("#%d: paused= %t, want %t", i, g, tt.w)
 		}
 	}
 }
@@ -1323,7 +1323,7 @@ func TestBcastBeat(t *testing.T) {
 	}
 }
 
-// tests the output of the statemachine when receiving MsgBeat
+// tests the output of the state machine when receiving MsgBeat
 func TestRecvMsgBeat(t *testing.T) {
 	tests := []struct {
 		state StateType

+ 4 - 4
wal/wal.go

@@ -60,7 +60,7 @@ var (
 	crcTable            = crc32.MakeTable(crc32.Castagnoli)
 )
 
-// WAL is a logical repersentation of the stable storage.
+// WAL is a logical representation of the stable storage.
 // WAL is either in read mode or append mode but not both.
 // A newly created WAL is in append mode, and ready for appending records.
 // A just opened WAL is in read mode, and ready for reading records.
@@ -189,7 +189,7 @@ func openAtIndex(dirpath string, snap walpb.Snapshot, write bool) (*WAL, error)
 	}
 
 	if write {
-		// open the lastest wal file for appending
+		// open the last wal file for appending
 		seq, _, err := parseWalName(names[len(names)-1])
 		if err != nil {
 			rc.Close()
@@ -315,7 +315,7 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
 
 // cut closes current file written and creates a new one ready to append.
 // cut first creates a temp wal file and writes necessary headers into it.
-// Then cut atomtically rename temp wal file to a wal file.
+// Then cut atomically rename temp wal file to a wal file.
 func (w *WAL) cut() error {
 	// close old wal file
 	if err := w.sync(); err != nil {
@@ -428,7 +428,7 @@ func (w *WAL) ReleaseLockTo(index uint64) error {
 	}
 
 	// if no lock index is greater than the release index, we can
-	// release lock upto the last one(excluding).
+	// release lock up to the last one(excluding).
 	if !found && len(w.locks) != 0 {
 		smaller = len(w.locks) - 1
 	}