Pass Cassandra session reference to http handlers
Yes, there definitely is a better way to do this. The easiest way would be to use reciever functions (aka methods) as handler functions. Rather than returning a handler from the ItemHandler func (bad name BTW), simple declare a handler directly.

Here's an example of how you could acchieve this:

type MyServer struct {
    cql *gocql.Session
}

func (s *MyServer) ItemHandler(w http.ResponseWriter, r *http.Request) {
    // use s.cql here
}

func New(cql *gocql.Session) (*MyServer, error) {
    s := &amp;MyServer{
        cql: cql,
    }
    // more stuff here
    return s, nil
}


Then, in your main package, simply write this:

s, err := cassandra.InitCassandraClient()
if err != nil {
    fmt.Println("Unable to set up Cassandra client!")
    os.Exit(1)
}
// assume package name server
srv, _ := server.New(&amp;s)
// now ItemHandler with srv as receiver is the handler
router.HandleFunc("/item", srv.ItemHandler)