Fixed crashing without arguments
This commit is contained in:
parent
92d4ff62f3
commit
ca05ff2eba
Binary file not shown.
|
@ -8,8 +8,6 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
//"time"
|
||||
//"strconv"
|
||||
)
|
||||
|
||||
type PlayerStats struct {
|
||||
|
@ -26,8 +24,8 @@ var names = []string{}
|
|||
var err error
|
||||
var guess string
|
||||
var guessLetter rune
|
||||
var filePath string = os.Args[1]
|
||||
var randWord string = getWord(filePath)
|
||||
var filePath string
|
||||
var randWord string
|
||||
var hiddenChars []string
|
||||
|
||||
func scanLine() (line string) {
|
||||
|
@ -43,6 +41,8 @@ func main() {
|
|||
fmt.Println("Usage: ./file-reader names.txt")
|
||||
os.Exit(1)
|
||||
}
|
||||
filePath = os.Args[1]
|
||||
randWord = getWord(filePath)
|
||||
|
||||
for range randWord {
|
||||
hiddenChars = append(hiddenChars, "_")
|
||||
|
@ -91,8 +91,6 @@ func gameStatus() {
|
|||
|
||||
func game() {
|
||||
clear()
|
||||
//filePath := os.Args[1]
|
||||
//randWord := getWord(filePath)
|
||||
for {
|
||||
gameStatus()
|
||||
if player.lives < 0 {
|
||||
|
|
Loading…
Reference in New Issue