https://github.com/goyek/goyek
Task automation Go library
https://github.com/goyek/goyek
go golang
Last synced: about 1 month ago
JSON representation
Task automation Go library
- Host: GitHub
- URL: https://github.com/goyek/goyek
- Owner: goyek
- License: other
- Created: 2020-10-11T13:20:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-02T11:00:25.000Z (about 1 year ago)
- Last Synced: 2024-04-02T12:55:34.230Z (about 1 year ago)
- Topics: go, golang
- Language: Go
- Homepage: https://pkg.go.dev/github.com/goyek/goyek/v2
- Size: 999 KB
- Stars: 496
- Watchers: 5
- Forks: 29
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-go - goyek - Create build pipelines in Go. (Build Automation)
- fucking-awesome-go - goyek - Create build pipelines in Go. (Build Automation)
- awesome-ccamel - goyek/goyek - Task automation Go library (Go)
- awesome-repositories - goyek/goyek - Task automation Go library (Go)
- awesome-go - goyek - Create build pipelines in Go. (Build Automation)
- awesome-go - goyek - Create build pipelines in Go. (Build Automation)
- awesome-go-extra - goyek - 10-11T13:20:55Z|2022-08-22T05:20:39Z| (Build Automation)
- awesome-go-with-stars - goyek - Create build pipelines in Go. (Build Automation)
- my-awesome - goyek/goyek - 04 star:0.6k fork:0.0k Task automation Go library (Go)
- awesome-go-cn - goyek
- awesome-go-plus - goyek - Create build pipelines in Go.  (Build Automation)
- awesome-go-plus - goyek - Create build pipelines in Go.  (Build Automation)
README
# goyek
[](https://pkg.go.dev/github.com/goyek/goyek/v2)
[](CHANGELOG.md)
[](go.mod)
[](https://goreportcard.com/report/github.com/goyek/goyek/v2)
[](https://codecov.io/gh/goyek/goyek)
[](https://github.com/avelino/awesome-go)**goyek** (/ˈɡɔɪæk/ [🔊 listen](https://ipa-reader.com/?text=%CB%88%C9%A1%C9%94%C9%AA%C3%A6k))
is a task automation library intended to be an alternative to
[Make](https://www.gnu.org/software/make/),
[Mage](https://github.com/magefile/mage),
[Task](https://taskfile.dev/).Please ⭐ `Star` this repository if you find it valuable.
The primary properties of goyek are:
- Library, not an application, with API inspired by
[`testing`](https://golang.org/pkg/testing),
[`cobra`](https://github.com/spf13/cobra),
[`flag`](https://golang.org/pkg/flag),
[`http`](https://golang.org/pkg/http).
- Cross-platform and shell independent.
- No binary installation needed.
- Easy to debug, like regular Go code.
- Tasks are defined similarly to
[`cobra`](https://github.com/spf13/cobra) commands.
- The task action looks like a Go test.
[`goyek.A`](https://pkg.go.dev/github.com/goyek/goyek/v2#A)
has similar methods to [`testing.T`](https://pkg.go.dev/testing#T).
- Reuse any Go code and library e.g. [`viper`](https://github.com/spf13/viper).
- Highly customizable.
- Zero third-party dependencies.
- Additional features in [`goyek/x`](https://github.com/goyek/x).## Usage
For build automation, store your code in the `build` directory.
The following example defines a simple `hello` task that logs a message
and prints the Go version.Create `build/hello.go`:
```go
package mainimport (
"flag""github.com/goyek/goyek/v2"
"github.com/goyek/x/cmd"
)var msg = flag.String("msg", "greeting message", "Hello world!")
var hello = goyek.Define(goyek.Task{
Name: "hello",
Usage: "demonstration",
Action: func(a *goyek.A) {
a.Log(*msg)
cmd.Exec(a, "go version")
},
})
```Create `build/main.go`:
```go
package mainimport (
"os""github.com/goyek/goyek/v2"
"github.com/goyek/x/boot"
)func main() {
if err := os.Chdir(".."); err != nil {
panic(err)
}
goyek.SetDefault(hello)
boot.Main()
}
```The packages from [`github.com/goyek/x`](https://pkg.go.dev/github.com/goyek/x)
are used for convenience.Run help:
```sh
cd build
go mod tidy
go run . -h
```Expected output:
```out
Usage of build: [flags] [--] [tasks]
Tasks:
hello demonstration
Flags:
-dry-run
print all tasks without executing actions
-long-run duration
print when a task takes longer (default 1m0s)
-msg string
Hello world! (default "greeting message")
-no-color
disable colorizing output
-no-deps
do not process dependencies
-skip comma-separated tasks
skip processing the comma-separated tasks
-v print all tasks as they are run
```Run with verbose output:
```sh
go run . -v
```Example output:
```out
===== TASK hello
hello.go:16: greeting message
hello.go:17: Exec: go version
go version go1.24.0 linux/amd64
----- PASS: hello (0.12s)
ok 0.123s
```Instead of running `go run .` inside `build`, you can use wrapper scripts:
- Bash: [`goyek.sh`](goyek.sh).
- PowerShell: [`goyek.ps1`](goyek.ps1).Use [`goyek/template`](https://github.com/goyek/template) when creating
a new repository. For existing repositories, simply copy the relevant files.Learn more:
- 📺 5-minute video: [Watch here](https://www.youtube.com/watch?v=e-xWEH-fqJ0)
([Slides](https://docs.google.com/presentation/d/1xFAPXeMiOD-92xeIHkUD-SHmJZwc8mSIIgpjuJXEW3U/edit?usp=sharing))
- 📚 [Package documentation](https://pkg.go.dev/github.com/goyek/goyek/v2)## Contributing
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## License
**goyek** is licensed under the terms of the [MIT license](LICENSE).
Note: **goyek** was named **taskflow** before v0.3.0.