include

package
v0.0.0-...-c0c3664 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package include provides functions and types that execute code inclusion in go files.

Index

Constants

View Source
const DefaultBuildTag = "include"

DefaultBuildTag is the default build tag to use when no other build tag has been given explicitly.

Variables

This section is empty.

Functions

func Include

func Include(filename string, source []byte, options Options) ([]byte, error)

Include processes the given source and returns the processed source as well as any error. Filename is only used in error messages.

func IncludeFile

func IncludeFile(src string, options Options) ([]byte, error)

IncludeFile performs the inclusion reading source code from src. It returns the generated source as well as any error occurred during processing.

Types

type Options

type Options struct {
	// BuildTag defines the build tag to toggle when generating code.
	BuildTag string

	// WorkingDir defines the current working directory used to resolve relative file name. If not set
	// defaults to the process' current working directory.
	WorkingDir string
}

Options defines the options to be passed when including files.

Jump to

Keyboard shortcuts

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