| 
									
										
										
										
											2018-11-13 17:43:25 +03:00
										 |  |  | // Copyright © 2018 Inanc Gumus | 
					
						
							|  |  |  | // Learn Go Programming Course | 
					
						
							|  |  |  | // License: https://creativecommons.org/licenses/by-nc-sa/4.0/ | 
					
						
							|  |  |  | // | 
					
						
							| 
									
										
										
										
											2019-10-30 19:34:44 +03:00
										 |  |  | // For more tutorials  : https://learngoprogramming.com | 
					
						
							|  |  |  | // In-person training  : https://www.linkedin.com/in/inancgumus/ | 
					
						
							|  |  |  | // Follow me on twitter: https://twitter.com/inancgumus | 
					
						
							| 
									
										
										
										
											2018-11-13 17:43:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | package main | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | 	"math/rand" | 
					
						
							|  |  |  | 	"os" | 
					
						
							|  |  |  | 	"time" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func main() { | 
					
						
							|  |  |  | 	args := os.Args[1:] | 
					
						
							|  |  |  | 	if len(args) != 1 { | 
					
						
							|  |  |  | 		fmt.Println("[your name]") | 
					
						
							|  |  |  | 		return | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	name := args[0] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	moods := [...]string{ | 
					
						
							|  |  |  | 		"happy 😀", "good 👍", "awesome 😎", | 
					
						
							|  |  |  | 		"sad 😞", "bad 👎", "terrible 😩", | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	rand.Seed(time.Now().UnixNano()) | 
					
						
							|  |  |  | 	n := rand.Intn(len(moods)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	fmt.Printf("%s feels %s\n", name, moods[n]) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // inspired from: | 
					
						
							|  |  |  | // https://github.com/moby/moby/blob/1fd7e4c28d3a4a21c3540f03a045f96a4190b527/pkg/namesgenerator/names-generator.go |