Skip to content

Commit b8c45d0

Browse files
committed
fix the stdin number convert to float
1 parent a1ad219 commit b8c45d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bat.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package main
1818

1919
import (
20+
"bytes"
2021
"crypto/tls"
2122
"encoding/json"
2223
"flag"
@@ -33,7 +34,7 @@ import (
3334
"strings"
3435
)
3536

36-
const version = "0.0.3"
37+
const version = "0.1.0"
3738

3839
var (
3940
ver bool
@@ -163,7 +164,9 @@ func main() {
163164
}
164165
if len(stdin) > 0 {
165166
var j interface{}
166-
err = json.Unmarshal(stdin, &j)
167+
d := json.NewDecoder(bytes.NewReader(stdin))
168+
d.UseNumber()
169+
err = d.Decode(&j)
167170
if err != nil {
168171
httpreq.Body(stdin)
169172
} else {

0 commit comments

Comments
 (0)