Stuck on handling some variables when trying to read a scruct out of a session

I’ve got this stuct and I’m saving it in a session variable.

type User struct {
	ID   int
	Name string
	Priv string
	Type string
}

and I have a my gob statement in my init():

func init() {

	// sets session information
	store.Options = &sessions.Options{
		Domain:   "localhost",
		Path:     "/",
		MaxAge:   3600 * 8, // 8 hours
		HttpOnly: true,
	}

	gob.Register(User{})
}

And I have this block of code to read it back out and my Go skills are failing me here:

session, _ := store.Get(r, "session")
if err != nil {
	http.Error(w, err.Error(), http.StatusInternalServerError)
	return
}

var sessionVal interface{}
var person User

sessionVal, ok = session.Values["user"]
if ok {
	person, ok = sessionVal.(User)
	if !ok {
		log.Printf("The session is not a User struct")
		person = User{-1, "", "", ""}
	}
} else {
	log.Printf("There is no Session")
}

data := map[string]interface{}{
	"Authenticated": isAuthenticated(r), // This will let us know if the page is viewed anonymously
	"Reservations":  reservations,
	"TestUser":      person,
}

What I want to do is check if session.Values[“user”] exists, if it does, assert it to the User type so that later I can pass it into my template (data). But if it’s blank, I want to ideally set the person to nil. But if I cant do that, I would take just setting person to some default values as you can see I’ve already done. But I’m getting mixed up in context and when the “ok” does and doesn’t work.

ooo! I fixed it on my own!

var person User

// Check if the variable exists in the session
if _, ok := session.Values["User"]; ok {
	// The variable exists in the session
	fmt.Println("User variable exists in session")
	person = session.Values["User"].(User)
} else {
	// The variable does not exist in the session
	fmt.Println("User variable absent from session")
}