github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/imports/read.go (about) 1 // Copyright 2012 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 // Copied from Go distribution src/go/build/read.go. 6 7 package imports 8 9 import ( 10 "github.com/shogo82148/std/io" 11 ) 12 13 // ReadComments is like io.ReadAll, except that it only reads the leading 14 // block of comments in the file. 15 func ReadComments(f io.Reader) ([]byte, error) 16 17 // ReadImports is like io.ReadAll, except that it expects a Go file as input 18 // and stops reading the input once the imports have completed. 19 func ReadImports(f io.Reader, reportSyntaxError bool, imports *[]string) ([]byte, error)