monoimporter

package
v0.0.0-...-d8fbaca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package monoimporter provides a monorepo-compatible types.Importer for Go packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(pkgPath string, filepaths []string, importer types.Importer) (*packages.Package, error)

Load loads a google3 package.

Types

type Importer

type Importer struct {
	// contains filtered or unexported fields
}

Importer implements a go/types.Importer for bazel-like monorepo build systems for Go packages.

While open source Go depends on GOPATH and GOROOT to find packages, bazel-like build systems such as blaze or buck rely on a monorepo-style package search instead of using GOPATH and standard library packages are found in a zipped archive instead of GOROOT.

func New

func New(ctxt build.Context, ua *unmappedArchives, ma *mappedArchives, sa *stdlibArchives, stdlibZip *zip.Reader) *Importer

New returns a new monorepo importer.

func NewFromZips

func NewFromZips(ctxt build.Context, unmappedArchs, mappedArchs, stdlibArchs, stdlibZips []string) (*Importer, error)

NewFromZips returns a new monorepo importer, using the build context to pick the desired standard library zip archive.

zips refers to zip file paths with Go standard library object files.

archives refers to directories in which to find compiled Go package object files.

func (*Importer) Import

func (i *Importer) Import(importPath string) (*types.Package, error)

Import implements types.Importer.Import.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL