func cmdUpdate(args []string) int { v := new(version.Version) if len(args) < 2 { flag.Usage() fmt.Fprintf(os.Stderr, "UPDATE requires APP and VERSION\n") return 1 } v.App = args[0] v.Ver = args[1] if len(args) > 2 { v.Host = args[2] } if len(args) > 3 { i, err := strconv.ParseUint(args[3], 10, 16) if err != nil { fmt.Println("Error parsing Intstance value:", args[3]) return 1 } v.Instance = uint16(i) } err := client.SendUDP(*server, *port, *v) if err != nil { fmt.Println(err) return 1 } return 0 }
func ExampleSendUDP() { v := version.Version{App: "app", Ver: "1.2.3", Host: "example.com"} err := client.SendUDP("localhost", 7777, v) if err != nil { // handle error } }
func main() { v := version.Version{App: "app", Ver: "1.2.3", Host: "example.com", Instance: 0} err := client.SendUDP("localhost", 7777, v) if err != nil { log.Fatal(err) } }