importcfg

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package importcfg provides utilities to deal with files accepted by the Go toolchain commands as the `-importcfg` flag value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImportConfig

type ImportConfig struct {
	// PackageFile maps package dependencies fully-qualified import paths to their build archive
	// location
	PackageFile map[string]string
	// ImportMap maps package dependencies import paths to their fully-qualified version
	ImportMap map[string]string
	// Extras is data read from an `importcfg` file that is not semantically parsed by this data
	// structure, which is stored only so it can be written back with an updated `importcfg` file if
	// necessary.
	Extras []string
}

ImportConfig represents the parsed out contents of an `importcfg` (or `importcfg.link`) file, usually passed to the Go compiler and linker via the `-importcfg` flag.

func ParseFile

func ParseFile(filename string) (ImportConfig, error)

ParseFile parses the contents of the provided `importcfg` (or `importcfg.link`) file.

func (*ImportConfig) CombinePackageFile

func (r *ImportConfig) CombinePackageFile(other *ImportConfig) (changed bool)

CombinePackageFile copies `packagefile` entries from other into the receiver unless it already has an entry with the same import path.

func (*ImportConfig) Lookup

func (r *ImportConfig) Lookup(path string) (io.ReadCloser, error)

Lookup opens the archive file for the provided import path. This allows the ImportConfig object to serve as a package information resolver's Lookup function.

func (*ImportConfig) WriteFile

func (r *ImportConfig) WriteFile(filename string) error

WriteFile writes the content of the package register to the provided file, in the format expected by the standard go toolchain commands.

Jump to

Keyboard shortcuts

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