Beispiel #1
0
func firstRun(r *bufio.Reader) {
	fmt.Println("Welcome to the chat server. Please type your desired alias")
	line, _ := r.ReadString('\n')
	// Send the correct alias and log him in
	line = "/nick " + line
	handleUserInput(line)

	// FIXME This doesn't check login errors
	fmt.Println("You are now on the server")
	fmt.Println("The current temperature is")
	b := make(chan string, 1)
	b <- weather.GetStringWeather("Guadalajara")
	var res string
	select {
	case s := <-b:
		res = s
	case <-time.After(5 * time.Second):
		res = "Timeout"
	}
	fmt.Println(res)
	fmt.Println("This is a list of command available")
	line = "/help"
	handleUserInput(line)
	fmt.Println()
}
Beispiel #2
0
func main() {
	w := TestStaticData()
	fmt.Println(w)
	s := weather.GetStringWeather("Guadalajara")
	fmt.Println("Weather in GDL", s)
}