package main import ( "encoding/gob" "log" "net" ) type Information struct { Name string Age int FavouriteSong string IsAdmin bool } func SendGob() { info := Information{ Name: "Raul", Age: 19, FavouriteSong: "Unknown", IsAdmin: true, } conn, err := net.Dial("tcp", "127.0.0.1:1302") if err != nil { log.Fatal(err) } defer conn.Close() enc := gob.NewEncoder(conn) err = enc.Encode(info) if err != nil { log.Fatalf("Error happened encoding data: %v\n", err) } }