Source file src/cmd/go/internal/mmap/mmap_other.go

     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 Data{}, err
    19  	}
    20  	return Data{f, b}, nil
    21  }
    22  

View as plain text