ardanlabs / gotour

Apache License 2.0
100 stars 60 forks source link

Error at line 38 in answer1.go #265

Closed yukendhiran closed 2 months ago

yukendhiran commented 3 months ago

Context: https://tour.ardanlabs.com/tour/eng/functions/2 Instead of declaration (:=) assignment (=)happen at line 38 in answer1.go

// Call the function and just check the error on the return.
_, err = newUser()
if err != nil {
    fmt.Println(err)
    return
}
ardan-bkennedy commented 3 months ago

I'm looking at the code for the answer and that is what's there and that is correct unless you want to move the if statement up. Which I would normally do.

        if _, err := newUser(); err != nil {
        fmt.Println(err)
        return
    }
yukendhiran commented 3 months ago

image I don't know but I'm getting like that at line 38 in default code and it also throw an error

it's just a small typo I wanted to infrom, btw the contents are super good

ardan-bkennedy commented 3 months ago

Give me a playground link with the error please. I don't see the problem and the code on the tour doesn't error.