-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* makefile adds * add files and commands * remove make tools and lint * changelog add
- Loading branch information
1 parent
c5c5ea3
commit dfcde30
Showing
6 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/golang:1.12.0 | ||
|
||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- go-mod-v1-{{ checksum "go.sum" }} | ||
- run: | ||
name: test | ||
command: | | ||
export PATH="$GOBIN:$PATH" | ||
go env | ||
go version | ||
make test | ||
- save_cache: | ||
key: go-mod-v1-{{ checksum "go.sum" }} | ||
paths: | ||
- "/go/pkg/mod" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## 0.1 | ||
|
||
**2019-07-16** | ||
|
||
Special thanks to external contributors on this release: | ||
|
||
### Initial Release | ||
|
||
- `db`, `random.go`, `bytes.go` and `os.go` from the tendermint repo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## 0.2 | ||
|
||
\*\* **YYYY-MM-DD** | ||
|
||
Special thanks to external contributors on this release: | ||
|
||
### BREAKING CHANGES | ||
|
||
### IMPROVEMENTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Contributing | ||
|
||
Thank you for considering making contributions to IAVL+! | ||
This repository follows the [contribution guidelines] of tendermint and the corresponding [coding repo]. | ||
Please take a look if you are not already familiar with those. | ||
|
||
[contribution guidelines]: https://github.com/tendermint/tendermint/blob/master/CONTRIBUTING.md | ||
[coding repo]: https://github.com/tendermint/coding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package common | ||
|
||
import ( | ||
"encoding/hex" | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// The main purpose of HexBytes is to enable HEX-encoding for json/encoding. | ||
type HexBytes []byte | ||
|
||
// Marshal needed for protobuf compatibility | ||
func (bz HexBytes) Marshal() ([]byte, error) { | ||
return bz, nil | ||
} | ||
|
||
// Unmarshal needed for protobuf compatibility | ||
func (bz *HexBytes) Unmarshal(data []byte) error { | ||
*bz = data | ||
return nil | ||
} | ||
|
||
// This is the point of Bytes. | ||
func (bz HexBytes) MarshalJSON() ([]byte, error) { | ||
s := strings.ToUpper(hex.EncodeToString(bz)) | ||
jbz := make([]byte, len(s)+2) | ||
jbz[0] = '"' | ||
copy(jbz[1:], []byte(s)) | ||
jbz[len(jbz)-1] = '"' | ||
return jbz, nil | ||
} | ||
|
||
// This is the point of Bytes. | ||
func (bz *HexBytes) UnmarshalJSON(data []byte) error { | ||
if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' { | ||
return fmt.Errorf("Invalid hex string: %s", data) | ||
} | ||
bz2, err := hex.DecodeString(string(data[1 : len(data)-1])) | ||
if err != nil { | ||
return err | ||
} | ||
*bz = bz2 | ||
return nil | ||
} | ||
|
||
// Allow it to fulfill various interfaces in light-client, etc... | ||
func (bz HexBytes) Bytes() []byte { | ||
return bz | ||
} | ||
|
||
func (bz HexBytes) String() string { | ||
return strings.ToUpper(hex.EncodeToString(bz)) | ||
} | ||
|
||
func (bz HexBytes) Format(s fmt.State, verb rune) { | ||
switch verb { | ||
case 'p': | ||
s.Write([]byte(fmt.Sprintf("%p", bz))) | ||
default: | ||
s.Write([]byte(fmt.Sprintf("%X", []byte(bz)))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters