cuelang.org/go@v0.13.0/internal/golangorgx/tools/gcimporter/iexport.go (about)

     1  // Copyright 2019 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
     6  
     7  import (
     8  	"fmt"
     9  	"go/token"
    10  	"go/types"
    11  	"io"
    12  )
    13  
    14  func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc) ([]byte, error) {
    15  	return nil, fmt.Errorf("we are not loading Go packages")
    16  }
    17  
    18  func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, path string, reportf ReportFunc) (*types.Package, error) {
    19  	return nil, fmt.Errorf("we are not loading Go packages")
    20  }
    21  
    22  type GetPackagesFunc = func(items []GetPackagesItem) error
    23  
    24  type GetPackagesItem struct {
    25  	Name, Path string
    26  	Pkg        *types.Package
    27  
    28  	pathOffset uint64
    29  	nameIndex  map[string]uint64
    30  }
    31  
    32  type ReportFunc = func(string, ...interface{})
    33  
    34  func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
    35  	return fmt.Errorf("we are not loading Go packages")
    36  }
    37  
    38  func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
    39  	return fmt.Errorf("we are not loading Go packages")
    40  }
    41  
    42  func FindPkg(path, srcDir string) (filename, id string) {
    43  	return
    44  }
    45  
    46  func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
    47  	return nil, fmt.Errorf("we are not loading Go packages")
    48  }