Skip to content

Commit

Permalink
fix short func
Browse files Browse the repository at this point in the history
  • Loading branch information
khorevaa committed Sep 2, 2021
1 parent 75ecfcb commit 161b7e3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 80 deletions.
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ go 1.17

require (
github.com/k0kubun/pp v3.0.1+incompatible
github.com/lyft/protoc-gen-star v0.5.3
github.com/satori/go.uuid v1.2.0
go.buf.build/v8platform/go-gen-ras/v8platform/rasapis v1.2.1
google.golang.org/protobuf v1.27.1
)

require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/spf13/afero v1.3.3 // indirect
github.com/spf13/cast v1.4.1 // indirect
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2 // indirect
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)
17 changes: 12 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand All @@ -10,7 +10,6 @@ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q
github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40=
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/lyft/protoc-gen-star v0.5.3 h1:zSGLzsUew8RT+ZKPHc3jnf8XLaVyHzTcAFBzHtCNR20=
github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand All @@ -22,12 +21,21 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54=
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/v8platform/encoder v0.0.1/go.mod h1:g6fd9SvAvmvi28QLQ6tzkoxbrh1xPGDNr+SDHINjAkI=
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2 h1:4Njy9y8svUoL+ncWSXxRhDBAExCl7r/dvT8BJ7Gi0/0=
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2/go.mod h1:M7qxAD3sf3aKWMnTTqSFKJYFahMjnf0EdhGpQeoXuUY=
go.buf.build/v8platform/go-gen-ras/v8platform/rasapis v1.2.1 h1:ECVYyNEViSHtKt6fImaWEQtpNmGoRDltFx5aiN5FwV0=
go.buf.build/v8platform/go-gen-ras/v8platform/rasapis v1.2.1/go.mod h1:y0b6WuLLqVK8EI2bS8CeGUypLqpWkZ8D1J97yPQpSWE=
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1 h1:32piBWFhkXabbnP7WSIRIvf2vUNw/zphib2NIJmctsY=
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1/go.mod h1:/iXLnyNRjJ8XHqitXULofZGlhhCYOzS/yfrXm0Zavd4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
Expand All @@ -38,7 +46,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
19 changes: 5 additions & 14 deletions ras/codec256/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,12 @@ const AgeDelta = 621355968000000
func ParseBytes(r io.Reader, data []byte) error {

if len(data) == 0 {
for {
// if len(data) == cap(data) {
// // Add more capacity (let append pick how much).
// data = append(data, 0)[:len(data)]
// }
_, err := r.Read(data[len(data):cap(data)])
// data = data[:len(data)+n]
if err != nil {
if err == io.EOF {
return nil
}
return err
}
var err error
data, err = io.ReadAll(r)
if err != nil {
return err
}

return nil
}

readLength := 0
Expand Down
24 changes: 24 additions & 0 deletions ras/codec256/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@ func FormatShort(w io.Writer, value interface{}) error {
val = uint16(*tVal)
case *uint16:
val = uint16(*tVal)
case int32:
val = uint16(tVal)
case uint32:
val = uint16(tVal)
case *int32:
val = uint16(*tVal)
case *uint32:
val = uint16(*tVal)
case int64:
val = uint16(tVal)
case uint64:
val = uint16(tVal)
case *int64:
val = uint16(*tVal)
case *uint64:
val = uint16(*tVal)
case int:
val = uint16(tVal)
case uint:
val = uint16(tVal)
case *int:
val = uint16(*tVal)
case *uint:
val = uint16(*tVal)
default:
return &TypeEncoderError{"short", "TODO"}
}
Expand Down
55 changes: 0 additions & 55 deletions ras/pb.go

This file was deleted.

0 comments on commit 161b7e3

Please sign in to comment.