I have the following Go example:
package main
import (
"fmt"
"log"
"os"
"strconv"
)
func main() {
numberOfUsers := 10
numberOfUsersStr, found := os.LookupEnv("NUMBER_OF_USERS")
if found {
numberOfUsers, err := strconv.Atoi(numberOfUsersStr)
if err != nil {
log.Fatalln(err)
}
}
fmt.Printf("Number of users: %d", numberOfUsers)
}
When building this snipper, I get the following error:
> go build -o app .
.\app.go:14:3: numberOfUsers declared but not used
Clearly the variable is used in the last print statement, however it seems hidden from the compiler. What am I missing?