Hmmm I understand now, thank you all Em segunda-feira, 18 de setembro de 2017 07:35:56 UTC-3, Elias Naur escreveu: > > Just to expand on Ian's reply: you seem to want to have loadPage return > any errors, similar to what ReaedFile does. If so, you need to declare > loadPage to return two values, like so: > > func loadPage(title string) (*Page, error) > > And return a nil *Page and the error if ReadFile fails: > > body, err := ioutil.ReadFile(filename) > if err != nil { > return nil, err > } > > The same goes for the sucess path: > > return &Page{Title: title, Body: body}, nil > > HTH, > - elias > > On Monday, September 18, 2017 at 7:25:39 AM UTC+2, Ian Lance Taylor wrote: >> >> You are trying to assign the result of loadPage to two variables, but >> loadPage only returns one result. >> >> In the "here is OK" section you are assigning the result of >> ioutil.ReadFile to two variables. That is OK because ioutil.ReadFile >> returns two results. You can see the definition of ioutil.ReadFile at >> https://golang.org/src/io/ioutil/ioutil.go#L45 . >> >> Ian >> >> >> >> On Sun, Sep 17, 2017 at 8:00 PM, Ângelo Chida <aka....@gmail.com> wrote: >> >>> Hi, I'm new in Golang but I'm PHP StackDev since 10 years ago >>> I'm following this tutorial https://golang.org/doc/articles/wiki/ on >>> how to build a web app, but I'm stuck on some error and can't find anywhere >>> a solution. Please help >>> Take a look at the image >>> My go version is 1.9 >>> >>> >>> <https://lh3.googleusercontent.com/-dLj3JRQea4g/Wb82fG86uaI/AAAAAAAAJ0Q/Uc9yZOWpHNc2cL4Da7XYRJzRQKyijY37QCLcBGAs/s1600/why.jpg>*sorry >>> >>> for poor english, it is not my native language >>> <https://lh3.googleusercontent.com/-dLj3JRQea4g/Wb82fG86uaI/AAAAAAAAJ0Q/Uc9yZOWpHNc2cL4Da7XYRJzRQKyijY37QCLcBGAs/s1600/why.jpg> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.