plugeth/common
Li, Cheng bd848aad7c
common: improve printing of Hash and Address (#21834)
Both Hash and Address have a String method, which returns the value as
hex with 0x prefix. They also had a Format method which tried to print
the value using printf of []byte. The way Format worked was at odds with
String though, leading to a situation where fmt.Sprintf("%v", hash)
returned the decimal notation and hash.String() returned a hex string.

This commit makes it consistent again. Both types now support the %v,
%s, %q format verbs for 0x-prefixed hex output. %x, %X creates
unprefixed hex output. %d is also supported and returns the decimal
notation "[1 2 3...]".

For Address, the case of hex characters in %v, %s, %q output is
determined using the EIP-55 checksum. Using %x, %X with Address
disables checksumming.

Co-authored-by: Felix Lange <fjl@twurst.com>
2020-12-08 19:19:09 +01:00
..
bitutil tests/fuzzers: improve the fuzzers (#21829) 2020-11-13 12:36:38 +01:00
compiler common/compiler: fix lint issue (#19967) 2019-08-15 12:12:56 +02:00
fdlimit common/fdlimit: build on DragonflyBSD (#21241) 2020-06-19 15:43:52 +02:00
hexutil all: remove redundant conversions and import names (#21903) 2020-11-25 21:00:23 +01:00
math accounts, signer: implement gnosis safe support (#21593) 2020-09-29 17:40:08 +02:00
mclock all: fix goroutine leaks in unit tests by adding 1-elem channel buffer (#20666) 2020-02-17 17:33:11 +01:00
prque les, les/lespay/server: refactor client pool (#21236) 2020-09-14 22:44:20 +02:00
big.go core, vm, common: define constantinople fork + shift (#16045) 2018-02-23 12:32:57 +02:00
bytes_test.go all: simplify and fix database iteration with prefix/start (#20808) 2020-04-15 14:08:53 +03:00
bytes.go common: remove ToHex and ToHexArray (#21610) 2020-11-04 11:20:39 +01:00
debug.go core: added basic chain configuration 2016-04-01 01:01:10 +02:00
format.go common, core, light: add block age into info logs 2018-09-20 12:56:35 +03:00
path.go common: improve documentation comments (#16701) 2018-05-29 12:42:21 +02:00
size_test.go cmd/utils, eth: relinquish GC cache to read cache in archive mode 2019-02-07 14:36:25 +02:00
size.go core, cmd, vendor: fixes and database inspection tool (#15) 2019-05-16 10:39:34 +03:00
test_utils.go all: fix license headers one more time 2015-07-23 18:35:11 +02:00
types_test.go common: improve printing of Hash and Address (#21834) 2020-12-08 19:19:09 +01:00
types.go common: improve printing of Hash and Address (#21834) 2020-12-08 19:19:09 +01:00