aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/internal
diff options
context:
space:
mode:
authornlwkobe30 <nlwkobe30@gmail.com>2024-08-30 19:05:07 +0000
committerGopher Robot <gobot@golang.org>2024-09-03 20:55:15 +0000
commit7cd0a4be5cdbb84142ec330daba6087eece48341 (patch)
tree498439f59e7cf228c9427c540bccdc7c2930fe7c /src/crypto/internal
parentb8e533a7cdc60d84a0c52bfaf3dcb5bf148ac3a8 (diff)
downloadgo-7cd0a4be5cdbb84142ec330daba6087eece48341.tar.xz
all: omit unnecessary 0 in slice expression
All changes are related to the code, except for the comments in src/regexp/syntax/parse.go and src/slices/slices.go. Change-Id: I73c5d3c54099749b62210aa7f3182c5eb84bb6a6 GitHub-Last-Rev: 794aa9b0539811d00e1cd42be1e8d9fe9afe0281 GitHub-Pull-Request: golang/go#69170 Reviewed-on: https://go-review.googlesource.com/c/go/+/609678 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/crypto/internal')
-rw-r--r--src/crypto/internal/cryptotest/aead.go8
-rw-r--r--src/crypto/internal/cryptotest/hash.go4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/crypto/internal/cryptotest/aead.go b/src/crypto/internal/cryptotest/aead.go
index e17cdf8cb8..a6107e5419 100644
--- a/src/crypto/internal/cryptotest/aead.go
+++ b/src/crypto/internal/cryptotest/aead.go
@@ -204,8 +204,8 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) {
out := sealMsg(t, aead, prefix, nonce, plaintext, addData)
// Check that Seal didn't alter the prefix
- if !bytes.Equal(out[0:len(prefix)], prefix) {
- t.Errorf("Seal alters dst instead of appending; got %s, want %s", truncateHex(out[0:len(prefix)]), truncateHex(prefix))
+ if !bytes.Equal(out[:len(prefix)], prefix) {
+ t.Errorf("Seal alters dst instead of appending; got %s, want %s", truncateHex(out[:len(prefix)]), truncateHex(prefix))
}
ciphertext := out[len(prefix):]
@@ -237,8 +237,8 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) {
out := openWithoutError(t, aead, prefix, nonce, ciphertext, addData)
// Check that Open didn't alter the prefix
- if !bytes.Equal(out[0:len(prefix)], prefix) {
- t.Errorf("Open alters dst instead of appending; got %s, want %s", truncateHex(out[0:len(prefix)]), truncateHex(prefix))
+ if !bytes.Equal(out[:len(prefix)], prefix) {
+ t.Errorf("Open alters dst instead of appending; got %s, want %s", truncateHex(out[:len(prefix)]), truncateHex(prefix))
}
after := out[len(prefix):]
diff --git a/src/crypto/internal/cryptotest/hash.go b/src/crypto/internal/cryptotest/hash.go
index a950dcb282..f03623dfa2 100644
--- a/src/crypto/internal/cryptotest/hash.go
+++ b/src/crypto/internal/cryptotest/hash.go
@@ -39,8 +39,8 @@ func TestHash(t *testing.T, mh MakeHash) {
sum := getSum(t, h, prefix) // Append new digest to prefix
// Check that Sum didn't alter the prefix
- if !bytes.Equal(sum[0:len(prefix)], prefix) {
- t.Errorf("Sum alters passed buffer instead of appending; got %x, want %x", sum[0:len(prefix)], prefix)
+ if !bytes.Equal(sum[:len(prefix)], prefix) {
+ t.Errorf("Sum alters passed buffer instead of appending; got %x, want %x", sum[:len(prefix)], prefix)
}
// Check that the appended sum wasn't affected by the prefix