github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/go/internal/gcimporter/gcimporter.go (about) 1 // Copyright 2011 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 // Package gcimporter implements Import for gc-generated object files. 6 package gcimporter 7 8 import ( 9 "github.com/shogo82148/std/go/token" 10 "github.com/shogo82148/std/go/types" 11 "github.com/shogo82148/std/io" 12 ) 13 14 // FindPkg returns the filename and unique package id for an import 15 // path based on package information provided by build.Import (using 16 // the build.Default build.Context). A relative srcDir is interpreted 17 // relative to the current working directory. 18 func FindPkg(path, srcDir string) (filename, id string, err error) 19 20 // Import imports a gc-generated package given its import path and srcDir, adds 21 // the corresponding package object to the packages map, and returns the object. 22 // The packages map must contain all packages already imported. 23 func Import(fset *token.FileSet, packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error)