code: func (cmd *CheckCommand) checkBitmapFile(path string) (err error) {
  	// Open file handle.
  	f, err := os.Open(path)
  	if err != nil {
  		return errors.Wrap(err, "opening file")
  	}
  	defer f.Close()
  
  	fi, err := f.Stat()
  	if err != nil {
  		return errors.Wrap(err, "statting file")
  	}
  
  	// Memory map the file.
  	data, err := syscall.Mmap(int(f.Fd()), 0, int(fi.Size()), syscall.PROT_READ, syscall.MAP_SHARED)
  	if err != nil {
  		return errors.Wrap(err, "mmapping")
  	}
  	defer func() {
  		e := syscall.Munmap(data)
  		if e != nil {
  			fmt.Fprintf(cmd.Stderr, "WARNING: munmap failed: %v", e)
  		}
  		// don't overwrite another error with this, but also indicate
  		// this error.
  		if err == nil {
  			err = e
  		}
  	}()
  	// Attach the mmap file to the bitmap.
  	bm := roaring.NewBitmap()
  	if err := bm.UnmarshalBinary(data); err != nil {
  		return errors.Wrap(err, "unmarshalling")
  	}
  
  	// Perform consistency check.
  	if err := bm.Check(); err != nil {
  		// Print returned errors.
  		switch err := err.(type) {
  		case roaring.ErrorList:
  			for i := range err {
  				fmt.Fprintf(cmd.Stdout, "%s: %s\n", path, err[i].Error())
  			}
  		default:
  			fmt.Fprintf(cmd.Stdout, "%s: %s\n", path, err.Error())
  		}
  	}
  
  	// Print success message if no errors were found.
  	fmt.Fprintf(cmd.Stdout, "%s: ok\n", path)
  
  	return nil
  }
docs: // checkBitmapFile performs a consistency check on path for a roaring bitmap file.