func (s *fileSystemServer) ServeOps(c *fuse.Connection) { // When we are done, we clean up by waiting for all in-flight ops then // destroying the file system. defer func() { s.opsInFlight.Wait() s.fs.Destroy() }() for { op, err := c.ReadOp() if err == io.EOF { break } if err != nil { panic(err) } s.opsInFlight.Add(1) go s.handleOp(op) } }