web applications - golang web programming tutorial code not working -


I am trying to learn to go for web programming. I am learning the language, and I recently got For the official site the tutorial has started.

So far, I'm stuck on the data structure part. I have copied the code word for the word

Here is the code:

  package main import ("fmt" "IO / ioutil") type page structure {title string Body [] byte} func (p * pages)) () (error) {filename: = p.Title + ".txt" returns ioutil.WriteFile (filename, P. body, 0600)} func loadPage (title string) ( * Page, error) {filename: = title + ".txt" body, err: = ioutil.ReadFile (filename) If mistake! = {Zero {return zero, error} return and page {title: body, body}, zero} func main () {p1: = & page {title: "test page", body: [] byte ("WHADDUP! ")} P1.save p2, _: = loadPage (" TestPage ") fmt.Println (string (p2.Body)}}   

is running $ build build wiki .go gives me the following:

  # order-line arguments ./main.go: 30: p1.save rated but it has not been used   

What is it that is wrong to me? It seems as if I have copied the code word for the word, except that the string is saved in the file.

p1.save is such a function, it is written, anything like this Does not, which compiler is "alert" about you (but with the go, what may be the warning is actually an error and prevents the compilation).

What do you want p1.save () , which is not the opposite of p1.save , run the function.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -