aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/hex
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2018-05-31 12:30:19 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2018-05-31 19:49:01 +0000
commita34e6650c0847ba54445b036dfd33e7d98fe8a2c (patch)
tree5d2fc1e31c0af2a72e40e2948756473a7205bc96 /src/encoding/hex
parente4259d67b9e1f0180a923faa512a1781465faac4 (diff)
downloadgo-a34e6650c0847ba54445b036dfd33e7d98fe8a2c.tar.gz
go-a34e6650c0847ba54445b036dfd33e7d98fe8a2c.zip
encoding/hex: improve Decode and DecodeString docs
Simplify the wording of both. Make the DecodeString docs more accurate: DecodeString returns a slice, not a string. Change-Id: Iba7003f55fb0a37aafcbeee59a30492c0f68aa4e Reviewed-on: https://go-review.googlesource.com/115615 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/encoding/hex')
-rw-r--r--src/encoding/hex/hex.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/encoding/hex/hex.go b/src/encoding/hex/hex.go
index 4cb26b6673..aee5aecb1a 100644
--- a/src/encoding/hex/hex.go
+++ b/src/encoding/hex/hex.go
@@ -50,8 +50,8 @@ func DecodedLen(x int) int { return x / 2 }
// Decode decodes src into DecodedLen(len(src)) bytes,
// returning the actual number of bytes written to dst.
//
-// Decode expects that src contain only hexadecimal
-// characters and that src should have an even length.
+// Decode expects that src contains only hexadecimal
+// characters and that src has even length.
// If the input is malformed, Decode returns the number
// of bytes decoded before the error.
func Decode(dst, src []byte) (int, error) {
@@ -101,10 +101,10 @@ func EncodeToString(src []byte) string {
// DecodeString returns the bytes represented by the hexadecimal string s.
//
-// DecodeString expects that src contain only hexadecimal
-// characters and that src should have an even length.
-// If the input is malformed, DecodeString returns a string
-// containing the bytes decoded before the error.
+// DecodeString expects that src contains only hexadecimal
+// characters and that src has even length.
+// If the input is malformed, DecodeString returns
+// the bytes decoded before the error.
func DecodeString(s string) ([]byte, error) {
src := []byte(s)
// We can use the source slice itself as the destination