09.5 修改pack1包中变量名PackFloat为pack1Float,保持本节教程代码和文本的一致性。 (#631)

* 修改pack1包中变量名PackFloat为pack1Float

* modify json.Decoder to json.NewDecoder
This commit is contained in:
Johnsen
2019-07-11 12:11:52 +08:00
committed by ᴊ. ᴄʜᴇɴ
parent 0da9500027
commit 3d60a65988
2 changed files with 2 additions and 2 deletions

View File

@@ -11,7 +11,7 @@
```go ```go
package pack1 package pack1
var Pack1Int int = 42 var Pack1Int int = 42
var PackFloat = 3.14 var pack1Float = 3.14
func ReturnStr() string { func ReturnStr() string {
return "Hello main!" return "Hello main!"

View File

@@ -216,7 +216,7 @@ func NewDecoder(r io.Reader) *Decoder
func NewEncoder(w io.Writer) *Encoder func NewEncoder(w io.Writer) *Encoder
``` ```
要想把 JSON 直接写入文件,可以使用 json.NewEncoder 初始化文件(或者任何实现 io.Writer 的类型),并调用 Encode();反过来与其对应的是使用 json.Decoder 和 Decode() 函数: 要想把 JSON 直接写入文件,可以使用 json.NewEncoder 初始化文件(或者任何实现 io.Writer 的类型),并调用 Encode();反过来与其对应的是使用 json.NewDecoder 和 Decode() 函数:
```go ```go
func NewDecoder(r io.Reader) *Decoder func NewDecoder(r io.Reader) *Decoder