mactsouk / mGo4th

Source code for Mastering Go, 4th edition.
MIT License
38 stars 25 forks source link

ch02/stats.go: if check for len(arguments) == 1 prevents random numbers from being used #10

Closed ChristopherChmielewski closed 3 months ago

ChristopherChmielewski commented 3 months ago

In function main in ch02/stats.go the following code prevents randomFloat from ever being used to populate the stats application with random data:

func main() {
    arguments := os.Args
    if len(arguments) == 1 { // This if check should be removed so random data can be generated if no args supplied
        fmt.Println("Need one or more arguments!")
        return
    }
...
ChristopherChmielewski commented 3 months ago

Nevermind, I see that modifying this file is an exercise at the end of the chapter.