From 6bf58a9f583841a0c920572d151298c969840e10 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Sat, 21 Dec 2019 23:11:01 +0000 Subject: [PATCH] Fix more namings to conform to Golang coding standards --- cmd/grumble/freeze.go | 16 ++++++++-------- pkg/cryptstate/cryptstate.go | 4 ++-- pkg/cryptstate/cryptstate_test.go | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/grumble/freeze.go b/cmd/grumble/freeze.go index 28adfec..2f148e8 100644 --- a/cmd/grumble/freeze.go +++ b/cmd/grumble/freeze.go @@ -308,27 +308,27 @@ func (user *User) Freeze() (fu *freezer.User, err error) { } // Unfreeze will merge the contents of a frozen User into an existing user struct. -func (u *User) Unfreeze(fu *freezer.User) { +func (user *User) Unfreeze(fu *freezer.User) { if fu.Name != nil { - u.Name = *fu.Name + user.Name = *fu.Name } if fu.CertHash != nil { - u.CertHash = *fu.CertHash + user.CertHash = *fu.CertHash } if fu.Email != nil { - u.Email = *fu.Email + user.Email = *fu.Email } if fu.TextureBlob != nil { - u.TextureBlob = *fu.TextureBlob + user.TextureBlob = *fu.TextureBlob } if fu.CommentBlob != nil { - u.CommentBlob = *fu.CommentBlob + user.CommentBlob = *fu.CommentBlob } if fu.LastChannelID != nil { - u.LastChannelID = int(*fu.LastChannelID) + user.LastChannelID = int(*fu.LastChannelID) } if fu.LastActive != nil { - u.LastActive = *fu.LastActive + user.LastActive = *fu.LastActive } } diff --git a/pkg/cryptstate/cryptstate.go b/pkg/cryptstate/cryptstate.go index 9803949..192ff5c 100644 --- a/pkg/cryptstate/cryptstate.go +++ b/pkg/cryptstate/cryptstate.go @@ -125,8 +125,8 @@ func (cs *CryptState) Decrypt(dst, src []byte) error { return errors.New("cryptstate: crypted length too short to decrypt") } - plain_len := len(src) - cs.Overhead() - if len(dst) < plain_len { + plainLen := len(src) - cs.Overhead() + if len(dst) < plainLen { return errors.New("cryptstate: not enough space in dst for plain text") } diff --git a/pkg/cryptstate/cryptstate_test.go b/pkg/cryptstate/cryptstate_test.go index 073d656..063b633 100644 --- a/pkg/cryptstate/cryptstate_test.go +++ b/pkg/cryptstate/cryptstate_test.go @@ -27,7 +27,7 @@ func TestOCB2AES128Encrypt(t *testing.T) { expected := [19]byte{ 0x1f, 0xfc, 0xdd, 0xb4, 0x68, 0x13, 0x68, 0xb7, 0x92, 0x67, 0xca, 0x2d, 0xba, 0xb7, 0x0d, 0x44, 0xdf, 0x32, 0xd4, } - expected_eiv := [aes.BlockSize]byte{ + expectedEiv := [aes.BlockSize]byte{ 0x1f, 0x2a, 0x9b, 0xd0, 0x2d, 0xa6, 0x8e, 0x46, 0x26, 0x85, 0x83, 0xe9, 0x14, 0x2a, 0xff, 0x2a, } @@ -40,7 +40,7 @@ func TestOCB2AES128Encrypt(t *testing.T) { t.Errorf("Mismatch in output") } - if !bytes.Equal(cs.EncryptIV[:], expected_eiv[:]) { + if !bytes.Equal(cs.EncryptIV[:], expectedEiv[:]) { t.Errorf("EIV mismatch") } } @@ -61,7 +61,7 @@ func TestOCB2AES128Decrypt(t *testing.T) { expected := [15]byte{ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, } - post_div := [aes.BlockSize]byte{ + postDiv := [aes.BlockSize]byte{ 0x1f, 0x2a, 0x9b, 0xd0, 0x2d, 0xa6, 0x8e, 0x46, 0x26, 0x85, 0x83, 0xe9, 0x14, 0x2a, 0xff, 0x2a, } @@ -77,7 +77,7 @@ func TestOCB2AES128Decrypt(t *testing.T) { t.Errorf("Mismatch in output") } - if !bytes.Equal(cs.DecryptIV, post_div[:]) { + if !bytes.Equal(cs.DecryptIV, postDiv[:]) { t.Errorf("Mismatch in DIV") } }