Explorar o código

Update gob2.go

为0创建不成功
gostar %!s(int64=10) %!d(string=hai) anos
pai
achega
111e409bb7
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      eBook/examples/chapter_12/gob2.go

+ 1 - 1
eBook/examples/chapter_12/gob2.go

@@ -28,7 +28,7 @@ func main() {
 	vc := VCard{"Jan", "Kersschot", []*Address{pa,wa}, "none"}
 	// fmt.Printf("%v: \n", vc) // {Jan Kersschot [0x126d2b80 0x126d2be0] none}: 
 	// using an encoder:
-	file, _ := os.OpenFile("vcard.gob", os.O_CREATE|os.O_WRONLY, 0)
+	file, _ := os.OpenFile("vcard.gob", os.O_CREATE|os.O_WRONLY, 0666)
 	defer file.Close()
 	enc := gob.NewEncoder(file)
 	err := enc.Encode(vc)