mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2025-08-05 15:12:33 +00:00
ch12: fix code path
This commit is contained in:
@@ -21,9 +21,8 @@ foo symbol (an unquoted name)
|
||||
|
||||
編碼是由一個encode遞歸函數完成,如下所示。它的結構本質上和前面的Display函數類似:
|
||||
|
||||
<u><i>gopl.io/ch12/sexpr</i></u>
|
||||
```Go
|
||||
gopl.io/ch12/sexpr
|
||||
|
||||
func encode(buf *bytes.Buffer, v reflect.Value) error {
|
||||
switch v.Kind() {
|
||||
case reflect.Invalid:
|
||||
@@ -151,5 +150,3 @@ omin.)" "Best Picture (Nomin.)")) (Sequel nil))
|
||||
**練習 12.6:** 脩改encode,作爲一個優化,忽略對是零值對象的編碼。
|
||||
|
||||
**練習 12.7:** 創建一個基於流式的API,用於S表達式的解碼,和json.Decoder(§4.5)函數功能類似。
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user