Fix more namings to conform to Golang coding standards

This commit is contained in:
Ola Bini 2019-12-21 23:11:01 +00:00
parent 74040ab0af
commit 6bf58a9f58
No known key found for this signature in database
GPG key ID: 6786A150F6A2B28F
3 changed files with 14 additions and 14 deletions

View file

@ -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
}
}

View file

@ -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")
}

View file

@ -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")
}
}