package mmap

import "cmd/go/internal/mmap"

The mmap package provides an abstraction for memory mapping files on different platforms.

Index

Types

type Data

type Data struct {
	Data []byte
	// contains filtered or unexported fields
}

Data is mmap'ed read-only data from a file. The backing file is never closed, so Data remains valid for the lifetime of the process.

func Mmap

func Mmap(file string) (Data, bool, error)

Mmap maps the given file into memory. The boolean result indicates whether the file was opened. If it is true, the caller should avoid attempting to write to the file on Windows, because Windows locks the open file, and writes to it will fail.

Source Files

mmap.go mmap_windows.go

Version
v1.25.0-rc.1
Published
Jun 11, 2025
Platform
windows/amd64
Imports
5 packages
Last checked
1 minute ago

Tools for package owners.