| 1 |
// Copyright 2022 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build (js && wasm) || wasip1 || plan9 |
| 6 |
|
| 7 |
package mmap |
| 8 |
|
| 9 |
import ( |
| 10 |
"io" |
| 11 |
"os" |
| 12 |
) |
| 13 |
|
| 14 |
// mmapFile on other systems doesn't mmap the file. It just reads everything. |
| 15 |
func mmapFile(f *os.File) (*Data, error) { |
| 16 |
b, err := io.ReadAll(f) |
| 17 |
if err != nil { |
| 18 |
return nil, err |
| 19 |
} |
| 20 |
return &Data{f, b, nil}, nil |
| 21 |
} |
| 22 |
|
| 23 |
func munmapFile(_ *Data) error { |
| 24 |
return nil |
| 25 |
} |