diff options
author | kiel barry <kiel.j.barry@gmail.com> | 2018-05-02 16:27:59 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-02 16:27:59 +0800 |
commit | a7720b592687706e4de954b7ee9e586ff21e455c (patch) | |
tree | e1c656d072d1e263fe9af114d251b65345202c76 /core | |
parent | 670bae4cd3e6b34d6db008b22b6f5c2afcb07e0a (diff) | |
download | dexon-a7720b592687706e4de954b7ee9e586ff21e455c.tar.gz dexon-a7720b592687706e4de954b7ee9e586ff21e455c.tar.zst dexon-a7720b592687706e4de954b7ee9e586ff21e455c.zip |
core: golint updates for this or self warning (#16633)
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/contract.go | 14 | ||||
-rw-r--r-- | core/vm/logger.go | 4 | ||||
-rw-r--r-- | core/vm/memory.go | 12 | ||||
-rw-r--r-- | core/vm/opcodes.go | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/core/vm/contract.go b/core/vm/contract.go index 66748e821..b466681db 100644 --- a/core/vm/contract.go +++ b/core/vm/contract.go @@ -139,15 +139,15 @@ func (c *Contract) Value() *big.Int { } // SetCode sets the code to the contract -func (self *Contract) SetCode(hash common.Hash, code []byte) { - self.Code = code - self.CodeHash = hash +func (c *Contract) SetCode(hash common.Hash, code []byte) { + c.Code = code + c.CodeHash = hash } // SetCallCode sets the code of the contract and address of the backing data // object -func (self *Contract) SetCallCode(addr *common.Address, hash common.Hash, code []byte) { - self.Code = code - self.CodeHash = hash - self.CodeAddr = addr +func (c *Contract) SetCallCode(addr *common.Address, hash common.Hash, code []byte) { + c.Code = code + c.CodeHash = hash + c.CodeAddr = addr } diff --git a/core/vm/logger.go b/core/vm/logger.go index dde1903bf..c32a7b404 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -31,9 +31,9 @@ import ( type Storage map[common.Hash]common.Hash -func (self Storage) Copy() Storage { +func (s Storage) Copy() Storage { cpy := make(Storage) - for key, value := range self { + for key, value := range s { cpy[key] = value } diff --git a/core/vm/memory.go b/core/vm/memory.go index 99a84d227..d5cc7870b 100644 --- a/core/vm/memory.go +++ b/core/vm/memory.go @@ -51,14 +51,14 @@ func (m *Memory) Resize(size uint64) { } // Get returns offset + size as a new slice -func (self *Memory) Get(offset, size int64) (cpy []byte) { +func (m *Memory) Get(offset, size int64) (cpy []byte) { if size == 0 { return nil } - if len(self.store) > int(offset) { + if len(m.store) > int(offset) { cpy = make([]byte, size) - copy(cpy, self.store[offset:offset+size]) + copy(cpy, m.store[offset:offset+size]) return } @@ -67,13 +67,13 @@ func (self *Memory) Get(offset, size int64) (cpy []byte) { } // GetPtr returns the offset + size -func (self *Memory) GetPtr(offset, size int64) []byte { +func (m *Memory) GetPtr(offset, size int64) []byte { if size == 0 { return nil } - if len(self.store) > int(offset) { - return self.store[offset : offset+size] + if len(m.store) > int(offset) { + return m.store[offset : offset+size] } return nil diff --git a/core/vm/opcodes.go b/core/vm/opcodes.go index 7fe55b72f..e3568eb00 100644 --- a/core/vm/opcodes.go +++ b/core/vm/opcodes.go @@ -375,10 +375,10 @@ var opCodeToString = map[OpCode]string{ SWAP: "SWAP", } -func (o OpCode) String() string { - str := opCodeToString[o] +func (op OpCode) String() string { + str := opCodeToString[op] if len(str) == 0 { - return fmt.Sprintf("Missing opcode 0x%x", int(o)) + return fmt.Sprintf("Missing opcode 0x%x", int(op)) } return str |