Commit 6cb3e01888ada1b9114cca68452f46ed2134b0cc
1 parent
4585fc0545
Exists in
master
출력 형식 변경
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
go/src/fullcycle/do-iperf/main.go
| @@ -36,7 +36,7 @@ func main() { | @@ -36,7 +36,7 @@ func main() { | ||
| 36 | out = f | 36 | out = f |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | - test("hw-wifi", host, out) | 39 | + test("hw-ethernet", host, out) |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | func test(code, host string, out io.Writer) { | 42 | func test(code, host string, out io.Writer) { |
| @@ -52,11 +52,11 @@ func test(code, host string, out io.Writer) { | @@ -52,11 +52,11 @@ func test(code, host string, out io.Writer) { | ||
| 52 | 52 | ||
| 53 | s := bufio.NewScanner(stdout) | 53 | s := bufio.NewScanner(stdout) |
| 54 | for s.Scan() { | 54 | for s.Scan() { |
| 55 | - fmt.Fprintf(out, "{\"code\": \"%v\", \"state\": %v, \"data\": \"%v\", \"timeout\": 10}\n", code, state, s.Text()) | 55 | + fmt.Fprintf(out, "{\"%v\": {\"progress\": %v, \"result\": \"%v\"}}\n", code, state, s.Text()) |
| 56 | if state < 90 { | 56 | if state < 90 { |
| 57 | state += 10 | 57 | state += 10 |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | - fmt.Fprintf(out, "{\"code\": \"%v\", \"state\": 100, \"data\": \"\", \"timeout\": 10}\n", code) | 61 | + fmt.Fprintf(out, "{\"%v\": {\"progress\": 100, \"result\": \"\"}}\n", code) |
| 62 | } | 62 | } |