Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.29 KB | None | 0 0
  1. func viewHandler(w http.ResponseWriter, r *http.Request) {
  2.     title := r.URL.Path[len("/view/"):]
  3.     p, _ := loadPage(title)
  4.     fmt.Printf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
  5. }
  6.  
  7. ----
  8.  
  9. Gives error:
  10.  
  11. cannot use w (type http.ResponseWriter) as type string in argument to fmt.Printf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement