ccgo

package
v3.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 35 Imported by: 1

Documentation

Overview

Package ccgo implements the ccgo command.

Index

Constants

View Source
const (
	Version = "3.12.6-20210922111124"
)

Variables

This section is empty.

Functions

func AbsCwd added in v3.8.19

func AbsCwd() (string, error)

AbsCwd returns the absolute working directory.

func Compile added in v3.8.19

func Compile(args ...string) ([]byte, error)

Compile executes Shell with cmd set to "ccgo".

func CopyDir added in v3.8.19

func CopyDir(dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool) (files int, bytes int64, rerr error)

CopyDir recursively copies src to dest, preserving permissions and times where/when possible. If canOverwrite is not nil, it is consulted whether a destination file can be overwritten. If canOverwrite is nil then destination is overwritten if permissions allow that, otherwise the function fails.

Src and dst must be in the slash form.

func CopyFile added in v3.8.19

func CopyFile(dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool) (n int64, rerr error)

CopyFile copies src to dest, preserving permissions and times where/when possible. If canOverwrite is not nil, it is consulted whether a destination file can be overwritten. If canOverwrite is nil then destination is overwritten if permissions allow that, otherwise the function fails.

Src and dst must be in the slash form.

func Env added in v3.8.19

func Env(key, dflt string) string

Env returns the value of environmental variable key of dflt otherwise.

func Fatal added in v3.8.19

func Fatal(stackTrace bool, args ...interface{})

Fatal prints its argumenst to os.Stderr and performs os.Exit(1). A stack trace is added if stackTrace is true.

func Fatalf added in v3.8.19

func Fatalf(stackTrace bool, s string, args ...interface{})

Fatalf prints a formatted message to os.Stderr and performs os.Exit(1). A stack trace is added if stackTrace is true.

func InDir added in v3.8.19

func InDir(dir string, f func() error) (err error)

InDir executes f in dir. Dir must be in slash form.

func Mkdirs added in v3.8.19

func Mkdirs(paths ...string) error

Mkdirs will create all paths. Paths must be in slash form.

func MustAbsCwd added in v3.8.19

func MustAbsCwd(stackTrace bool) string

MustAbsCwd is like AbsCwd but executes Fatal(stackTrace, err) if it fails.

func MustCompile added in v3.8.19

func MustCompile(stackTrace bool, args ...string) []byte

MustCompile is like Compile but if executes Fatal(stackTrace, err) if it fails.

func MustCopyDir added in v3.8.19

func MustCopyDir(stackTrace bool, dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool) (files int, bytes int64)

MustCopyDir is like CopyDir, but it executes Fatal(stackTrace, errú if it fails.

func MustCopyFile added in v3.8.19

func MustCopyFile(stackTrace bool, dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool) int64

MustCopyFile is like CopyFile but it executes Fatal(stackTrace, err) if it fails.

func MustInDir added in v3.8.19

func MustInDir(stackTrace bool, dir string, f func() error)

MustInDir is like InDir but it executes Fatal(stackTrace, err) if it fails.

func MustMkdirs added in v3.8.19

func MustMkdirs(stackTrace bool, paths ...string)

MustMkdirs is like Mkdir but if executes Fatal(stackTrace, err) if it fails.

func MustRun added in v3.12.43

func MustRun(stackTrace bool, args ...string) []byte

MustRun is like Run but if executes Fatal(stackTrace, err) if it fails.

func MustShell added in v3.8.19

func MustShell(stackTrace bool, cmd string, args ...string) []byte

MustShell is like Shell but it executes Fatal(stackTrace, err) if it fails.

func MustTempDir added in v3.8.19

func MustTempDir(stackTrace bool, dir, name string) string

MustTempDir is like ioutil.TempDir but executes Fatal(stackTrace, err) if it fails. The returned path is absolute.

func MustUntar added in v3.8.19

func MustUntar(stackTrace bool, dst string, r io.Reader, canOverwrite func(fn string, fi os.FileInfo) bool)

MustUntar is like Untar but it executes Fatal(stackTrace, err) if it fails.

func MustUntarFile added in v3.8.19

func MustUntarFile(stackTrace bool, dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool)

MustUntarFile is like UntarFile but it executes Fatal(stackTrace, err) if it fails.

func Run added in v3.12.43

func Run(args ...string) ([]byte, error)

Run is like Compile, but executes in-process.

func Shell added in v3.8.19

func Shell(cmd string, args ...string) ([]byte, error)

Shell echoes and executes cmd with args and returns the combined output if the command.

func Untar added in v3.8.19

func Untar(dst string, r io.Reader, canOverwrite func(fn string, fi os.FileInfo) bool) error

Untar extracts a tar.gz archive into dst. If canOverwrite is not nil, it is consulted whether a destination file can be overwritten. If canOverwrite is nil then destination is overwritten if permissions allow that, otherwise the function fails.

Dst must be in the slash form.

func UntarFile added in v3.8.19

func UntarFile(dst, src string, canOverwrite func(fn string, fi os.FileInfo) bool) error

UntarFile extracts a named tar.gz archive into dst. If canOverwrite is not nil, it is consulted whether a destination file can be overwritten. If canOverwrite is nil then destination is overwritten if permissions allow that, otherwise the function fails.

Src and dst must be in the slash form.

Types

type Task

type Task struct {
	D []string // -D
	I []string // -I
	U []string // -U

	// Path to a binary that will be called instead of executing
	// Task.Main().  Intended to support TestGenerate in stable vs latest
	// modes. This is _not_ supposed to be used when the Task instance is
	// constructed by a ccgo _command_ (ccgo/v3) - it should never set this
	// field. Only programs importing ccgo/v3/lib that opt-in into this
	// feature should ever set it.
	CallOutBinary string

	E bool // -E
	// contains filtered or unexported fields
}

Task represents a compilation job.

func NewTask

func NewTask(args []string, stdout, stderr io.Writer) *Task

NewTask returns a newly created Task.

func (*Task) Main

func (t *Task) Main() (err error)

Main executes task.

Jump to

Keyboard shortcuts

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