// Copyright 2011 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.
// Package gcimporter implements Import for gc-generated object files.
package gcimporter // import "go/internal/gcimporter"import ()// Import imports a gc-generated package given its import path and srcDir, adds// the corresponding package object to the packages map, and returns the object.// The packages map must contain all packages already imported.func ( *token.FileSet, map[string]*types.Package, , string, func( string) (io.ReadCloser, error)) ( *types.Package, error) {vario.ReadCloservarstringif != nil {// With custom lookup specified, assume that caller has // converted path to a canonical import path for use in the map.if == "unsafe" {returntypes.Unsafe, nil } = // No need to re-import if the package was imported completely before.if = []; != nil && .Complete() {return } , := ()if != nil {returnnil, } = } else {varstring , , = exportdata.FindPkg(, )if == "" {if == "unsafe" {returntypes.Unsafe, nil }returnnil, }// no need to re-import if the package was imported completely beforeif = []; != nil && .Complete() {return }// open file , := os.Open()if != nil {returnnil, }deferfunc() {if != nil {// add file name to error = fmt.Errorf("%s: %v", , ) } }() = }defer .Close() := bufio.NewReader() , := exportdata.ReadUnified()if != nil { = fmt.Errorf("import %q: %v", , )return } := string() := pkgbits.NewPkgDecoder(, ) = readUnifiedPackage(, nil, , )return}
The pages are generated with Goldsv0.7.3. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.