golang

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Language = core.SourceLanguage{
	ID:     goLang,
	Sitter: golang.GetLanguage(),
	CapabilityFinder: lang.NewCapabilityFinder("comment", lang.CompositePreprocessor(
		lang.RegexpRemovePreprocessor(`//\s*`),
		func(comment string) string {

			if !strings.HasPrefix(comment, "/*") {
				return comment
			}

			comment = comment[1 : len(comment)-1]
			comment = multilineCommentMarginRegexp.ReplaceAllString(comment, "")

			return comment
		},
	)),
}

Functions

func AddRuntimeFile

func AddRuntimeFile(unit *core.ExecutionUnit, templateData any, path string, content []byte) error

func DeleteImportNodes added in v0.6.2

func DeleteImportNodes(f *core.SourceFile) error

func FindFilesForPackageName added in v0.6.2

func FindFilesForPackageName(unit *core.ExecutionUnit, pkgName string) []*core.SourceFile

func NewFile

func NewFile(path string, content io.Reader) (f *core.SourceFile, err error)

func UpdateImportsInFile added in v0.6.2

func UpdateImportsInFile(f *core.SourceFile, importsToAdd []Import, importsToRemove []Import) error

Types

type AddExecRuntimeFiles

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

func (*AddExecRuntimeFiles) Name

func (p *AddExecRuntimeFiles) Name() string

func (*AddExecRuntimeFiles) Transform

func (p *AddExecRuntimeFiles) Transform(result *core.CompilationResult, deps *core.Dependencies) error

type Argument added in v0.6.3

type Argument struct {
	Content string
	Type    string
}

func (*Argument) IsString added in v0.6.3

func (a *Argument) IsString() bool

type Expose

type Expose struct {
	Config *config.Application
	// contains filtered or unexported fields
}

func (*Expose) Name

func (p *Expose) Name() string

func (Expose) Transform

func (p Expose) Transform(result *core.CompilationResult, deps *core.Dependencies) error

type GoMod

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

func NewGoMod

func NewGoMod(path string, content io.Reader) (*GoMod, error)

func (*GoMod) AddLine

func (pf *GoMod) AddLine(text string)

func (*GoMod) Clone

func (pf *GoMod) Clone() core.File

func (*GoMod) Path

func (pf *GoMod) Path() string

func (*GoMod) WriteTo

func (pf *GoMod) WriteTo(out io.Writer) (int64, error)

type GoPlugins

type GoPlugins struct {
	Plugins []core.Plugin
}

func NewGoPlugins

func NewGoPlugins(cfg *config.Application, runtime Runtime) *GoPlugins

func (GoPlugins) Name

func (c GoPlugins) Name() string

func (GoPlugins) Transform

func (c GoPlugins) Transform(result *core.CompilationResult, deps *core.Dependencies) error

type GolangExecutable

type GolangExecutable struct {
}

func (GolangExecutable) Name

func (l GolangExecutable) Name() string

func (GolangExecutable) Transform

func (l GolangExecutable) Transform(result *core.CompilationResult, dependencies *core.Dependencies) error

type HttpListener added in v0.6.3

type HttpListener struct {
	Identifier *sitter.Node
	Expression *sitter.Node
	Address    *sitter.Node
}

type Import added in v0.6.2

type Import struct {
	Alias    string
	Package  string
	SpecNode *sitter.Node
}

func GetImportsInFile added in v0.6.2

func GetImportsInFile(f *core.SourceFile) []Import

func GetNamedImportInFile added in v0.6.3

func GetNamedImportInFile(f *core.SourceFile, namedImport string) Import

func (*Import) ToString added in v0.6.2

func (i *Import) ToString() string

type Package added in v0.6.2

type Package struct {
	Node *sitter.Node
	Name string
}

func FindPackageNode added in v0.6.2

func FindPackageNode(f *core.SourceFile) Package

type PersistFsPlugin added in v0.6.3

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

func (PersistFsPlugin) Name added in v0.6.3

func (p PersistFsPlugin) Name() string

func (PersistFsPlugin) Transform added in v0.6.3

func (p PersistFsPlugin) Transform(result *core.CompilationResult, deps *core.Dependencies) error

type PersistSecretsPlugin added in v0.6.3

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

func (PersistSecretsPlugin) Name added in v0.6.3

func (p PersistSecretsPlugin) Name() string

func (PersistSecretsPlugin) Transform added in v0.6.3

func (p PersistSecretsPlugin) Transform(result *core.CompilationResult, deps *core.Dependencies) error

type Runtime

type Runtime interface {
	AddExecRuntimeFiles(unit *core.ExecutionUnit, result *core.CompilationResult, deps *core.Dependencies) error
	GetFsImports() []Import
	GetSecretsImports() []Import
	SetConfigType(id string, isSecret bool)
	ActOnExposeListener(unit *core.ExecutionUnit, f *core.SourceFile, listener *HttpListener, routerName string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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