summaryrefslogtreecommitdiff
path: root/src/pkg/bytes
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/bytes')
-rw-r--r--src/pkg/bytes/buffer.go16
-rw-r--r--src/pkg/bytes/bytes.go16
-rw-r--r--src/pkg/bytes/bytes_test.go12
3 files changed, 11 insertions, 33 deletions
diff --git a/src/pkg/bytes/buffer.go b/src/pkg/bytes/buffer.go
index 875086525..a448dff84 100644
--- a/src/pkg/bytes/buffer.go
+++ b/src/pkg/bytes/buffer.go
@@ -37,9 +37,7 @@ type Buffer struct {
// Bytes returns the contents of the unread portion of the buffer;
// len(b.Bytes()) == b.Len().
-func (b *Buffer) Bytes() []byte {
- return b.buf[b.off : len(b.buf)];
-}
+func (b *Buffer) Bytes() []byte { return b.buf[b.off : len(b.buf)] }
// String returns the contents of the unread portion of the buffer
// as a string. If the Buffer is a nil pointer, it returns "<nil>".
@@ -53,9 +51,7 @@ func (b *Buffer) String() string {
// Len returns the number of bytes of the unread portion of the buffer;
// b.Len() == len(b.Bytes()).
-func (b *Buffer) Len() int {
- return len(b.buf) - b.off;
-}
+func (b *Buffer) Len() int { return len(b.buf) - b.off }
// Truncate discards all but the first n unread bytes from the buffer.
// It is an error to call b.Truncate(n) with n > b.Len().
@@ -69,9 +65,7 @@ func (b *Buffer) Truncate(n int) {
// Reset resets the buffer so it has no content.
// b.Reset() is the same as b.Truncate(0).
-func (b *Buffer) Reset() {
- b.Truncate(0);
-}
+func (b *Buffer) Reset() { b.Truncate(0) }
// Write appends the contents of p to the buffer. The return
// value n is the length of p; err is always nil.
@@ -166,9 +160,7 @@ func (b *Buffer) ReadByte() (c byte, err os.Error) {
// NewBuffer creates and initializes a new Buffer
// using buf as its initial contents.
-func NewBuffer(buf []byte) *Buffer {
- return &Buffer{buf: buf};
-}
+func NewBuffer(buf []byte) *Buffer { return &Buffer{buf: buf} }
// NewBufferString creates and initializes a new Buffer
// using string s as its initial contents.
diff --git a/src/pkg/bytes/bytes.go b/src/pkg/bytes/bytes.go
index 05d87fcb6..3ebc8373a 100644
--- a/src/pkg/bytes/bytes.go
+++ b/src/pkg/bytes/bytes.go
@@ -155,9 +155,7 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte {
// Split splits the array s around each instance of sep, returning an array of subarrays of s.
// If sep is empty, Split splits s after each UTF-8 sequence.
// If n > 0, Split splits s into at most n subarrays; the last subarray will contain an unsplit remainder.
-func Split(s, sep []byte, n int) [][]byte {
- return genSplit(s, sep, 0, n);
-}
+func Split(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) }
// SplitAfter splits the array s after each instance of sep, returning an array of subarrays of s.
// If sep is empty, SplitAfter splits s after each UTF-8 sequence.
@@ -244,19 +242,13 @@ func Map(mapping func(rune int) int, s []byte) []byte {
}
// ToUpper returns a copy of the byte array s with all Unicode letters mapped to their upper case.
-func ToUpper(s []byte) []byte {
- return Map(unicode.ToUpper, s);
-}
+func ToUpper(s []byte) []byte { return Map(unicode.ToUpper, s) }
// ToUpper returns a copy of the byte array s with all Unicode letters mapped to their lower case.
-func ToLower(s []byte) []byte {
- return Map(unicode.ToLower, s);
-}
+func ToLower(s []byte) []byte { return Map(unicode.ToLower, s) }
// ToTitle returns a copy of the byte array s with all Unicode letters mapped to their title case.
-func ToTitle(s []byte) []byte {
- return Map(unicode.ToTitle, s);
-}
+func ToTitle(s []byte) []byte { return Map(unicode.ToTitle, s) }
// Trim returns a slice of the string s, with all leading and trailing white space
// removed, as defined by Unicode.
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go
index ee727f0cd..b00de1b0c 100644
--- a/src/pkg/bytes/bytes_test.go
+++ b/src/pkg/bytes/bytes_test.go
@@ -287,17 +287,11 @@ func TestMap(t *testing.T) {
}
}
-func TestToUpper(t *testing.T) {
- runStringTests(t, ToUpper, "ToUpper", upperTests);
-}
+func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) }
-func TestToLower(t *testing.T) {
- runStringTests(t, ToLower, "ToLower", lowerTests);
-}
+func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTests) }
-func TestTrimSpace(t *testing.T) {
- runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests);
-}
+func TestTrimSpace(t *testing.T) { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) }
type AddTest struct {
s, t string;