Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettek/gobl
Go as a Makefile! Sort of!
https://github.com/kettek/gobl
Last synced: 19 days ago
JSON representation
Go as a Makefile! Sort of!
- Host: GitHub
- URL: https://github.com/kettek/gobl
- Owner: kettek
- License: gpl-3.0
- Created: 2020-01-09T14:47:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-02T00:33:49.000Z (2 months ago)
- Last Synced: 2024-11-02T01:21:09.510Z (2 months ago)
- Language: Go
- Size: 60.5 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gobl - Go Build
[![Go Reference](https://pkg.go.dev/badge/github.com/kettek/gobl.svg)](https://pkg.go.dev/github.com/kettek/gobl)`gobl` is an experimental build system that uses Go to define and run build tasks. Although it is actively used to develop other programs, it is by no means stable and may have breaking API changes if any redesigns are required. However, syntax _should_ largely remain the same, as I find its current syntax to be simple to use, which is one of the primary goals of it.
## Quickstart
In your project root directory, simply create a file called `gobl.go` and fill its contents with the following:```go
package mainimport (
. "github.com/kettek/gobl"
)func main() {
Task("listFiles").
Exec("ls")Go()
}```
You will likely have to get the gobl dependency by issuing `go get -d github.com/kettek/gobl`.
At this point, you can list the tasks by issuing `go run .` and then run the specific task with `go run . listFiles`
A more complex example that would allow automatic rebuilding + running, would be:
```go
package mainimport (
. "github.com/kettek/gobl"
)func main() {
Task("build").
Exec("go", "build", "./cmd/mycmd")Task("run").
Exec("mycmd")Task("watch").
Watch("./pkg/*/*.go").
Signaler(SigQuit).
Run("build").
Run("run")Go()
}
```## Task Steps
For a complete rundown of available steps, see the [godoc task reference](https://pkg.go.dev/github.com/kettek/[email protected]/pkg/task).## Visual Studio Code Integration
There is a task provider extension for VSCode that allows using gobl tasks as VSCode tasks. It is available as [Gobl Task Provider](https://marketplace.visualstudio.com/items?itemName=kettek.gobl-task-provider) and has a GitHub repository [here](https://github.com/kettek/vscode-gobl-task-provider).## Why
* 1. I like Go.
* 2. Having the full power of Go available for setting up and running build tasks is very convenient.
* 3. Go's syntax is elegant.
* 4. It's an interesting concept.Of course, there are some inconveniences, such as:
* 1. Technically running `go run .` does first compile the task script and run it from a temporary directory.
* 2. It takes the place of `main() {...}` in whatever directory it is in. This shouldn't be problem for most popular go project layout styles, but could be an issue for some.
* 3. `go.mod` and `go.sum` adds some clutter.