A Go-native build orchestrator, type-safe and dependency-free.
Why GOBAKE?
A Programmer's Best Friend
Go-Native
Go-Native is Go-native.
Fast and elegant.
Go-Native changed how we build. It's the most natural build tool I've ever experienced.
Fezcode
CREATOR
Zero Dependencies
Zero Dependencies is Go-native.
Fast and elegant.
Zero Dependencies changed how we build. It's the most natural build tool I've ever experienced.
Samil B.
ARCHITECT
Metadata Management
Metadata Management is Go-native.
Fast and elegant.
Metadata Management changed how we build. It's the most natural build tool I've ever experienced.
Fezcoddy
DESIGNER
Self-Bootstrapping
Self-Bootstrapping is Go-native.
Fast and elegant.
Self-Bootstrapping changed how we build. It's the most natural build tool I've ever experienced.
Neural Nexus
KERNEL
DOCUMENTATION
Core Concepts
gobake operates on a simple principle: Your build system should be as robust as your application.
Instead of relying on fragile shell scripts or complex Makefiles, gobake uses:
- Engine: The core Go library that manages tasks.
- Context: A helper object passed to every task, providing access to the shell, logging, and metadata.
- Recipe: The
Recipe.gofile that ties it all together.
CLI Command Reference
Project Management
gobake init: Initialize a new project in the current directory.gobake version: Show the current version of gobake.gobake help: Show the list of available commands and project tasks.gobake template <git-url>: Clone a repository and initialize it.
Dependency & Tool Management
gobake add-tool <url>: Adds a tool to the(tools)list inrecipe.piml.gobake add-dep <url>: Adds a library dependency togo.mod.
Versioning
gobake bump [patch|minor|major]: Increments the project version inrecipe.piml.
Metadata (recipe.piml)
The recipe.piml file is the single source of truth for your project.
(name) my-project
(version) 1.2.3
(authors)
> Ahmed <ahmed@example.com>
(tools)
> github.com/swaggo/swag/cmd/swag@latest
Task Management
Tasks are defined using bake.Task(name, description, function).
Task Dependencies
You can define tasks that depend on other tasks using bake.TaskWithDeps.
bake.Task("test", "Run tests", func(ctx *gobake.Context) error { ... })
bake.TaskWithDeps("build", "Build app", []string{"test"}, func(ctx *gobake.Context) error { ... })
gobake Examples
1. Cross-Compilation for Multiple Platforms
This recipe builds your application for Windows, Linux, and macOS.
package main
import (
"fmt"
"github.com/fezcode/gobake"
)
func main() {
bake := gobake.NewEngine()
bake.LoadRecipeInfo("recipe.piml")
bake.Task("release", "Build for all platforms", func(ctx *gobake.Context) error {
platforms := []struct {
OS string
Arch string
Ext string
}{
{"linux", "amd64", ""},
{"windows", "amd64", ".exe"},
{"darwin", "arm64", ""},
}
for _, p := range platforms {
output := fmt.Sprintf("dist/%s-%s-%s%s",
bake.Info.Name, p.OS, p.Arch, p.Ext)
err := ctx.BakeBinary(p.OS, p.Arch, output, "-ldflags", "-s -w")
if err != nil {
return err
}
}
return nil
})
bake.Execute()
}
2. Using External Tools
This recipe installs stringer and uses it to generate code before building.
recipe.piml:
(name) my-app
(tools)
> golang.org/x/tools/cmd/stringer@latest
Recipe.go:
package main
import "github.com/fezcode/gobake"
func main() {
bake := gobake.NewEngine()
bake.LoadRecipeInfo("recipe.piml")
bake.Task("generate", "Generates code", func(ctx *gobake.Context) error {
// Ensure tools are installed first
if err := ctx.InstallTools(); err != nil {
return err
}
ctx.Log("Running stringer...")
return ctx.Run("go", "generate", "./...")
})
bake.Task("build", "Builds app", func(ctx *gobake.Context) error {
if err := ctx.Run("gobake", "generate"); err != nil {
return err
}
return ctx.Run("go", "build", ".")
})
bake.Execute()
}
GUIDE NAV
READY TO GOBAKE?
go install github.com/fezcode/gobake/cmd/gobake@latest