Documentation
¶
Overview ¶
Package spell provides incantations for different kinds.
Index ¶
Constants ¶
const ( // KindNameBinary is the Kind name for binary spells. KindNameBinary = "binary" // KindNameGoCode is the Kind name for Go code spells. KindNameGoCode = "go.code" // KindNameGoModule is the Kind name for Go module spells. KindNameGoModule = "go.module" // KindNameUnknown is the name for a unknown spell Kind. KindNameUnknown = "unknown" )
const ( // ErrExec indicates that a GoCode spell incantation returned an error during the code execution. ErrExec = wErr.ErrString("error returned during execution") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binary ¶
type Binary interface { Incantation // Env returns additional environment variables. Env() map[string]string }
Binary is a Incantation for commands which are using a binary executable.
type ErrGoCode ¶
type ErrGoCode struct { // Err is a wrapped error. Err error // Kind is the error kind. Kind error }
ErrGoCode represents a GoCode error.
type GoCode ¶
type GoCode interface { Incantation // Cast casts itself. Cast() (interface{}, error) }
GoCode is a Incantation for actions that can be casted without a cast.Caster. It is a special incantations in that it allows to use Go code as spell while still being compatible to the incantation API. Note that the Incantation.Formula of a GoCode must always return an empty slice, otherwise it is a "normal" Incantation that requires a cast.Caster.
Seen from the abstract "Harry Potter" view this is equal to a "non-verbal" spell that is a special technique that can be used for spells that have been specially designed to be used non-verbally.
References
(1) https://en.wikipedia.org/wiki/Magic_in_Harry_Potter#Spellcasting (2) https://www.reddit.com/r/harrypotter/comments/4z9rwl/what_is_the_difference_between_a_spell_charm
type GoModule ¶
type GoModule interface { Binary // GoModuleID returns the identifier of a Go module. GoModuleID() *project.GoModuleID }
GoModule is a Binary for binary command executables managed by a Go module.
See https://golang.org/ref/mod for more details.
type Incantation ¶
type Incantation interface { // Formula returns all parameters of a spell. Formula() []string // Kind returns the Kind of a spell. Kind() Kind // Options returns the options of a spell. Options() interface{} }
Incantation is the abstract representation of flags and parameters for a command or action. It is mainly handled by a cast.Caster that provides the corresponding information about the command like the path to the executable.
The separation of parameters from commands enables a flexible usage, e.g. when the parameters can be reused for a different command.
The abstract view and naming is inspired by the fantasy novel "Harry Potter" in which it is almost only possible to cast a magic spell through a incantation.
References
(1) https://en.wikipedia.org/wiki/Incantation (2) https://en.wikipedia.org/wiki/Magic_in_Harry_Potter#Spellcasting (3) https://scifi.stackexchange.com/a/33234 (4) https://harrypotter.fandom.com/wiki/Spell (5) https://diffsense.com/diff/incantation/spell
type Kind ¶
type Kind uint32
Kind defines the kind of a spell.
func (Kind) MarshalText ¶
MarshalText returns the textual representation of itself.
func (*Kind) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler to unmarshal a textual representation of itself.
Directories
¶
Path | Synopsis |
---|---|
fs
|
|
clean
Package clean provides a spell incantation to remove directories in a filesystem.
|
Package clean provides a spell incantation to remove directories in a filesystem. |
Package goimports provides a spell incantation for the "golang.org/x/tools/cmd/goimports" Go module command that allows to update Go import lines, add missing ones and remove unreferenced ones.
|
Package goimports provides a spell incantation for the "golang.org/x/tools/cmd/goimports" Go module command that allows to update Go import lines, add missing ones and remove unreferenced ones. |
Package golang provides spell incantations for Go toolchain commands.
|
Package golang provides spell incantations for Go toolchain commands. |
build
Package build provides a spell incantation for the "build" command of the Go toolchain.
|
Package build provides a spell incantation for the "build" command of the Go toolchain. |
test
Package test provide a spell incantation for the "test" command of the Go toolchain.
|
Package test provide a spell incantation for the "test" command of the Go toolchain. |
Package golangcilint provides a spell incantation for the "github.com/golangci/golangci-lint/cmd/golangci-lint" Go module command, a fast, parallel runner for dozens of Go linters that uses caching, supports YAML configurations and has integrations with all major IDEs.
|
Package golangcilint provides a spell incantation for the "github.com/golangci/golangci-lint/cmd/golangci-lint" Go module command, a fast, parallel runner for dozens of Go linters that uses caching, supports YAML configurations and has integrations with all major IDEs. |
Package gox provides a spell incantation for the "github.com/mitchellh/gox" Go module command, a dead simple, no frills Go cross compile tool that behaves a lot like the standard Go toolchain "build" command.
|
Package gox provides a spell incantation for the "github.com/mitchellh/gox" Go module command, a dead simple, no frills Go cross compile tool that behaves a lot like the standard Go toolchain "build" command. |