Help us shape the future of Go! Take the 2026 Go Developer Survey

build

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: BSD-2-Clause Imports: 28 Imported by: 54

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportPaths

func ImportPaths(vs ...string) ([]string, error)

func NewBuildContext

func NewBuildContext(installSuffix string, buildTags []string) *build.Context

NewBuildContext creates a build context for building Go packages with GopherJS compiler.

Core GopherJS packages (i.e., "github.com/gopherjs/gopherjs/js", "github.com/gopherjs/gopherjs/nosync") are loaded from gopherjspkg.FS virtual filesystem rather than GOPATH.

func NewMappingCallback

func NewMappingCallback(m *sourcemap.Map, goroot, gopath string, localMap bool) func(generatedLine, generatedColumn int, originalPos token.Position)

Types

type ImportCError

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

func (*ImportCError) Error

func (e *ImportCError) Error() string

type Options

type Options struct {
	GOROOT         string
	GOPATH         string
	Verbose        bool
	Quiet          bool
	Watch          bool
	CreateMapFile  bool
	MapToLocalDisk bool
	Minify         bool
	Color          bool
	BuildTags      []string
}

func (*Options) PrintError

func (o *Options) PrintError(format string, a ...interface{})

func (*Options) PrintSuccess

func (o *Options) PrintSuccess(format string, a ...interface{})

type PackageData

type PackageData struct {
	*build.Package
	JSFiles   []string
	IsTest    bool // IsTest is true if the package is being built for running tests.
	UpToDate  bool
	IsVirtual bool // If true, the package does not have a corresponding physical directory on disk.
}

func ImportDir

func ImportDir(dir string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error)

ImportDir is like Import but processes the Go package found in the named directory.

type Session

type Session struct {
	Archives map[string]*compiler.Archive
	Types    map[string]*types.Package
	Watcher  *fsnotify.Watcher
	// contains filtered or unexported fields
}

func NewSession

func NewSession(options *Options, tests bool, imports ...string) (*Session, error)

func (*Session) BuildContext

func (s *Session) BuildContext() *build.Context

BuildContext returns the session's build context.

func (*Session) BuildDir

func (s *Session) BuildDir(packagePath string, importPath string, pkgObj string) error

func (*Session) BuildFiles

func (s *Session) BuildFiles(filenames []string, pkgObj string, packagePath string) error

func (*Session) BuildImportPath

func (s *Session) BuildImportPath(path string) (*PackageData, *compiler.Archive, error)

func (*Session) BuildPackage

func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error)

func (*Session) Cleanup

func (s *Session) Cleanup() error

func (*Session) GO111MODULE

func (s *Session) GO111MODULE() bool

func (*Session) Import

func (s *Session) Import(path string, mode build.ImportMode, installSuffix string, buildTags []string) (*PackageData, error)

Import returns details about the Go package named by the import path. If the path is a local import path naming a package that can be imported using a standard import path, the returned package will set p.ImportPath to that path.

In the directory containing the package, .go and .inc.js files are considered part of the package except for:

  • .go files in package documentation
  • files starting with _ or . (likely editor temporary files)
  • files with build constraints not satisfied by the context

If an error occurs, Import returns a non-nil error and a nil *PackageData.

func (*Session) InstallSuffix

func (s *Session) InstallSuffix() string

func (*Session) IsModulePath

func (s *Session) IsModulePath(path string) (string, bool)

func (*Session) WaitForChange

func (s *Session) WaitForChange()

func (*Session) WriteCommandPackage

func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string) error

Jump to

Keyboard shortcuts

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