code: func (state *UserState) SetUsernameCookie(w http.ResponseWriter, username string) error {
  	if username == "" {
  		return ErrCookieEmptyUsername
  	}
  	if !state.HasUser(username) {
  		return ErrCookieUserMissing
  	}
  	// Create a cookie that lasts for a while ("timeout" seconds),
  	// this is the equivivalent of a session for a given username.
  	cookie.SetSecureCookiePath(w, "user", username, state.cookieTime, "/", state.cookieSecret)
  	return nil
  }
docs: // Store the given username in a cookie in the browser, if possible.
  // The user must exist.