Browse Source

update changelog; add rudis script for safe keeping

pull/1780/head
Ethan Buchman 7 years ago
parent
commit
e3f6666ecc
5 changed files with 64 additions and 5 deletions
  1. +1
    -0
      .gitignore
  2. +7
    -2
      CHANGELOG.md
  3. +1
    -1
      example/example.go
  4. +55
    -0
      types/protoreplace/protoreplace.go
  5. +0
    -2
      types/result.go

+ 1
- 0
.gitignore View File

@ -1,2 +1,3 @@
vendor
.glide
types/types.pb.go

+ 7
- 2
CHANGELOG.md View File

@ -4,15 +4,20 @@
BREAKING CHANGES:
- [client] all XxxSync methods now return (ResponseXxx, error)
- [types] Application: all methods now take RequestXxx and return (ResponseXxx, error).
- [types] all methods on Application interface now take RequestXxx and return (ResponseXxx, error).
- Except `CheckTx`/`DeliverTx`, which takes a `tx []byte` argument.
- Except `Commit`, which takes no arguments.
- [types] removed Result
- [types] removed Result and ResultQuery
- [types] removed CodeType - only `0 == OK` is defined here, everything else is left to convention at the application level
- [types] switched to using `gogo/protobuf` for code generation
- [types] use `customtype` feature of `gogo/protobuf` to replace `[]byte` with `data.Bytes` in all generated types :)
- this eliminates the need for additional types like ResultQuery
FEATURES:
- [types] added Tags field to ResponseDeliverTx
- [types] added Gas and Fee fields to ResponseCheckTx
- [dummy] DeliverTx returns tags
- [abci-cli] added `log_level` flag to control the logger
## 0.7.1 (November 14, 2017)


+ 1
- 1
example/example.go View File

@ -1,3 +1,3 @@
package example
// so go get doesnt complain
// so the go tool doesn't return errors about no buildable go files ...

+ 55
- 0
types/protoreplace/protoreplace.go View File

@ -0,0 +1,55 @@
package main
// +build ignore
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"regexp"
"strings"
)
// This script replaces most `[]byte` with `data.Bytes` in a `.pb.go` file.
// It was written before we realized we could use `gogo/protobuf` to achieve
// this more natively. So it's here for safe keeping in case we ever need to
// abandon `gogo/protobuf`.
func main() {
bytePattern := regexp.MustCompile("[[][]]byte")
const oldPath = "types/types.pb.go"
const tmpPath = "types/types.pb.new"
content, err := ioutil.ReadFile(oldPath)
if err != nil {
panic("cannot read " + oldPath)
os.Exit(1)
}
lines := bytes.Split(content, []byte("\n"))
outFile, _ := os.Create(tmpPath)
wroteImport := false
for _, line_bytes := range lines {
line := string(line_bytes)
gotPackageLine := strings.HasPrefix(line, "package ")
writeImportTime := strings.HasPrefix(line, "import ")
containsDescriptor := strings.Contains(line, "Descriptor")
containsByteArray := strings.Contains(line, "[]byte")
if containsByteArray && !containsDescriptor {
line = string(bytePattern.ReplaceAll([]byte(line), []byte("data.Bytes")))
}
if writeImportTime && !wroteImport {
wroteImport = true
fmt.Fprintf(outFile, "import \"github.com/tendermint/go-wire/data\"\n")
}
if gotPackageLine {
fmt.Fprintf(outFile, "%s\n", "//nolint: gas")
}
fmt.Fprintf(outFile, "%s\n", line)
}
outFile.Close()
os.Remove(oldPath)
os.Rename(tmpPath, oldPath)
exec.Command("goimports", "-w", oldPath)
}

+ 0
- 2
types/result.go View File

@ -4,8 +4,6 @@ import (
"fmt"
)
// type CodeType uint32
const (
CodeTypeOK uint32 = 0
)


Loading…
Cancel
Save