github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/vfs/os_std_alloc.go (about)

     1  //go:build !(linux || darwin) || sqlite3_flock || sqlite3_nosys
     2  
     3  package vfs
     4  
     5  import (
     6  	"io"
     7  	"os"
     8  )
     9  
    10  func osAllocate(file *os.File, size int64) error {
    11  	off, err := file.Seek(0, io.SeekEnd)
    12  	if err != nil {
    13  		return err
    14  	}
    15  	if size <= off {
    16  		return nil
    17  	}
    18  	return file.Truncate(size)
    19  }