func (s *Server) Unmount(mountPoint string, timeout int) (err error) {
	for i := 0; i < timeout; i++ {
		err = fuse.Unmount(mountPoint)
		if err == nil {
			err = s.conn.Close()
			if err != nil {
				log.Fatalln(err)
			}
			return nil
		}
		log.Println(err)
	}
	err = s.conn.Close()
	return err
}
Unmount attempts to unmount the filesystem
package lib
import (
	"bazil.org/fuse"
	"bazil.org/fuse/fs"
	"code.google.com/p/goauth2/oauth"
	drive "code.google.com/p/google-api-go-client/drive/v2"
	"log"
	"time"
)
type Server struct {
	Config *oauth.Config
	conn   *fuse.Conn
}
func NewServer(config *oauth.Config, code string) (*Server, error) {
	d := &Server{Config: config}
	transport := &oauth.Transport{Config: config}
	token, err := config.TokenCache.Token()
	if err != nil {
		if d.Config.ClientId == "" || d.Config.ClientSecret == "" {
			log.Fatal("Both Client Id and Client Secret must be given")
		}
		if code == "" {
			GetCodeURL(d.Config)
		}
		token, err = transport.Exchange(code)
		if err != nil {
			log.Fatal("Exchange:", err)
		}
		log.Printf("Token is cached in %v\n", d.Config.TokenCache)
	}
	transport.Token = token
	client = transport.Client()
	nameToDir = make(map[string]*DriveDir)
	nameToFile = make(map[string]*DriveFile)
	idToDir = make(map[string]*DriveDir)
	idToFile = make(map[string]*DriveFile)
	service, err = drive.New(client)
	return d, err
}
func GetCodeURL(config *oauth.Config) {
	url := config.AuthCodeURL("")
	log.Println("Visit this URL to get a code, then run again with -code=YOUR_CODE\n")
	log.Fatalln(url)
}
func (s *Server) Mount(mountPoint string) (err error) {
	s.conn, err = fuse.Mount(mountPoint)
	return
}
func (s *Server) Serve(refreshRate int) {
	refreshFileIndex()
	refreshChildIndex()
	refreshNameToFile()
	refreshNameToDir()
	go func() {
		for {
			<-time.After(time.Duration(refreshRate) * time.Second)
			log.Println("Refreshing indexes.")
			refreshFileIndex()
			go refreshChildIndex()
			go refreshNameToFile()
			go refreshNameToDir()
		}
	}()
	if err := fs.Serve(s.conn, Root{}); err != nil {
		log.Fatalf("Could not serve drivefs %s", err.Error())
	}
}