standard

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Standard package provides plugin that performs operations of the Go standard toolset. Things like compiling or running the base `go` prefixed commands.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModuleNameNeeded   = errors.New("module name needed")
	ErrModuleNameNotFound = errors.New("module name not found")
	ErrFileMainNotExist   = errors.New("main.go file does not exist")
)

Functions

This section is empty.

Types

type Fixer

type Fixer struct{}

Fixer is in charge of performing a Fix operation that moves the main.go to cmd/[name-of-the-module]/main.go

func (Fixer) Fix

func (f Fixer) Fix(ctx context.Context, root string, args []string) error

Fix does the main.go magic - Determine if the file exists - Determine if there is a go.mod - Determine the name of the module (last part when slicing go.mod by /) - Create folder - Copy/move main.go to that folder

func (Fixer) Name

func (f Fixer) Name() string

type Plugin

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

Compiler takes care of compiling the go binary, this might be one of the last steps when we have done other phases of the build process.

func (*Plugin) Build

func (g *Plugin) Build(ctx context.Context, root string, args []string) error

Build runs the Go compiler to generate the desired binary. Assuming the Go executable installed and can be invoked with `go`.

IMPORTANT: it uses the static build flags.

func (*Plugin) Flags

func (b *Plugin) Flags() *pflag.FlagSet

ParseFlags

func (Plugin) Name

func (g Plugin) Name() string

func (*Plugin) ParseFlags

func (b *Plugin) ParseFlags(args []string)

ParseFlags

func (*Plugin) RunBeforeTest

func (b *Plugin) RunBeforeTest(ctx context.Context, root string, args []string) error

func (*Plugin) Test

func (p *Plugin) Test(ctx context.Context, root string, args []string) error

Jump to

Keyboard shortcuts

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