Skip to content

Commit 161b7e3

Browse files
committed
fix short func
1 parent 75ecfcb commit 161b7e3

5 files changed

Lines changed: 45 additions & 80 deletions

File tree

go.mod

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ go 1.17
44

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

1212
require (
13-
github.com/golang/protobuf v1.5.2 // indirect
14-
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
1513
github.com/mattn/go-colorable v0.1.8 // indirect
1614
github.com/mattn/go-isatty v0.0.12 // indirect
17-
github.com/spf13/afero v1.3.3 // indirect
15+
github.com/spf13/cast v1.4.1 // indirect
16+
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2 // indirect
17+
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1 // indirect
1818
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
19-
golang.org/x/text v0.3.6 // indirect
20-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
2119
)

go.sum

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
21
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
34
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
4-
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
55
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
66
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
77
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -10,7 +10,6 @@ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q
1010
github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40=
1111
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
1212
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
13-
github.com/lyft/protoc-gen-star v0.5.3 h1:zSGLzsUew8RT+ZKPHc3jnf8XLaVyHzTcAFBzHtCNR20=
1413
github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w=
1514
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
1615
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@@ -22,12 +21,21 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
2221
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2322
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
2423
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
25-
github.com/spf13/afero v1.3.3 h1:p5gZEKLYoL7wh8VrJesMaYeNxdEd1v3cb4irOk9zB54=
2624
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
25+
github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA=
26+
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
2727
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
28+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
2829
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
2930
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
3031
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
32+
github.com/v8platform/encoder v0.0.1/go.mod h1:g6fd9SvAvmvi28QLQ6tzkoxbrh1xPGDNr+SDHINjAkI=
33+
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2 h1:4Njy9y8svUoL+ncWSXxRhDBAExCl7r/dvT8BJ7Gi0/0=
34+
go.buf.build/v8platform/go-gen-ras/v8platform/encodingapis v1.2.2/go.mod h1:M7qxAD3sf3aKWMnTTqSFKJYFahMjnf0EdhGpQeoXuUY=
35+
go.buf.build/v8platform/go-gen-ras/v8platform/rasapis v1.2.1 h1:ECVYyNEViSHtKt6fImaWEQtpNmGoRDltFx5aiN5FwV0=
36+
go.buf.build/v8platform/go-gen-ras/v8platform/rasapis v1.2.1/go.mod h1:y0b6WuLLqVK8EI2bS8CeGUypLqpWkZ8D1J97yPQpSWE=
37+
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1 h1:32piBWFhkXabbnP7WSIRIvf2vUNw/zphib2NIJmctsY=
38+
go.buf.build/v8platform/go-gen-ras/v8platform/serializeapis v1.2.1/go.mod h1:/iXLnyNRjJ8XHqitXULofZGlhhCYOzS/yfrXm0Zavd4=
3139
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
3240
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
3341
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -38,7 +46,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
3846
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
3947
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4048
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
41-
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
4249
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4350
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
4451
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

ras/codec256/decode.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,12 @@ const AgeDelta = 621355968000000
3535
func ParseBytes(r io.Reader, data []byte) error {
3636

3737
if len(data) == 0 {
38-
for {
39-
// if len(data) == cap(data) {
40-
// // Add more capacity (let append pick how much).
41-
// data = append(data, 0)[:len(data)]
42-
// }
43-
_, err := r.Read(data[len(data):cap(data)])
44-
// data = data[:len(data)+n]
45-
if err != nil {
46-
if err == io.EOF {
47-
return nil
48-
}
49-
return err
50-
}
38+
var err error
39+
data, err = io.ReadAll(r)
40+
if err != nil {
41+
return err
5142
}
52-
43+
return nil
5344
}
5445

5546
readLength := 0

ras/codec256/encode.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,30 @@ func FormatShort(w io.Writer, value interface{}) error {
9595
val = uint16(*tVal)
9696
case *uint16:
9797
val = uint16(*tVal)
98+
case int32:
99+
val = uint16(tVal)
100+
case uint32:
101+
val = uint16(tVal)
102+
case *int32:
103+
val = uint16(*tVal)
104+
case *uint32:
105+
val = uint16(*tVal)
106+
case int64:
107+
val = uint16(tVal)
108+
case uint64:
109+
val = uint16(tVal)
110+
case *int64:
111+
val = uint16(*tVal)
112+
case *uint64:
113+
val = uint16(*tVal)
114+
case int:
115+
val = uint16(tVal)
116+
case uint:
117+
val = uint16(tVal)
118+
case *int:
119+
val = uint16(*tVal)
120+
case *uint:
121+
val = uint16(*tVal)
98122
default:
99123
return &TypeEncoderError{"short", "TODO"}
100124
}

ras/pb.go

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)