RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
How to encode data and write to file with gob?
package main import ( "encoding/gob" "os" ) type User struct { Username string Password string } func main() { user := User{ "zola", "supersecretpassword", } file, _ := os.Create("user.go...
How to read data from file and decode with go?
package main import ( "encoding/gob" "fmt" "os" ) type User struct { Username string Password string } func main() { user := User{} file, _ := os.Open("user.gob") defer file.Close() decoder := gob...
How to encode an interface with gob?
package main import ( "encoding/gob" "fmt" "os" ) type User struct { Username string Password string } type Admin struct { Username string Password string IsAdmin bool } type Deleter interface { Delete() } ...
How to decode an interface with gob?
package main import ( "encoding/gob" "fmt" "log" "os" ) type User struct { Username string Password string } type Admin struct { Username string Password string IsAdmin bool } type Deleter interface ...
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website