48 lines
638 B
Go
48 lines
638 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
var check bool = false
|
|
var choice string
|
|
var err error
|
|
|
|
func mainStatus() {
|
|
clear()
|
|
fmt.Printf("[1] Basic concurrency\n")
|
|
fmt.Printf("[2] Channels\n")
|
|
fmt.Printf("[3] Exit\n")
|
|
fmt.Printf("\rChoose your function: ")
|
|
}
|
|
|
|
func main() {
|
|
var numChoice int
|
|
|
|
for {
|
|
mainStatus()
|
|
|
|
strChoice := scanLine()
|
|
numChoice, err = strconv.Atoi(strChoice)
|
|
catchErr(err)
|
|
|
|
switch numChoice {
|
|
case 1:
|
|
fun1()
|
|
os.Exit(0)
|
|
case 2:
|
|
fun2()
|
|
os.Exit(0)
|
|
case 3:
|
|
os.Exit(0)
|
|
default:
|
|
fmt.Printf("Choose an actual function, please\n")
|
|
time.Sleep(time.Second)
|
|
}
|
|
}
|
|
|
|
}
|