The GoFlow CLI is a command-line tool for creating and managing GoFlow projects, inspired by Flutter's CLI.
go install github.com/base-go/GoFlow/cmd/goflow@latestThis installs the goflow binary to your $GOPATH/bin. Ensure it's in your PATH:
export PATH=$PATH:$(go env GOPATH)/bingit clone https://github.com/base-go/GoFlow.git
cd GoFlow/cmd/goflow
go build -ldflags="-s -w" -o goflow
sudo mv goflow /usr/local/bin/ # Optional: install globallygoflow version
# Output: GoFlow CLI v0.1.0Creates a new GoFlow project with the specified configuration.
goflow create <project_name> [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--platforms |
string | macos,windows,linux |
Comma-separated list of target platforms |
--template |
string | default |
Project template to use |
--org |
string | com.example |
Organization name for Go module path |
macos- macOS desktop (GLFW + WGPU)windows- Windows desktop (GLFW + WGPU)linux- Linux desktop (GLFW + WGPU)web- WebAssembly (future)
####Available Templates
default - Standard counter app template
- Demonstrates basic widgets (Text, Container, Column, Center)
- Shows signal-based state management
- Includes increment function
- Good starting point for most apps
minimal - Minimal "Hello World" template
- Simplest possible GoFlow app
- Just displays centered text
- Perfect for learning the basics
- Quick prototyping
material - Material Design-inspired template
- Card-like layout with header
- Colored containers and styling
- More polished UI example
- Best for production-like apps
Basic Project Creation
# Create with all default platforms
goflow create myapp
# Created directory structure:
# myapp/
# ├── lib/
# ├── macos/
# ├── windows/
# ├── linux/
# ├── assets/
# └── go.modPlatform-Specific Creation
# Create for macOS only
goflow create myapp --platforms=macos
# Create for macOS and Linux
goflow create myapp --platforms=macos,linux
# Create with web support (future)
goflow create myapp --platforms=macos,webTemplate Selection
# Create with minimal template
goflow create quickstart --template=minimal
# Create with material design template
goflow create myapp --template=material
# Create with default template (explicit)
goflow create myapp --template=defaultCustom Organization
# Use custom organization
goflow create myapp --org=com.mycompany
# Creates module: com.mycompany/myapp
# Instead of: com.example/myappCombined Flags
goflow create myapp \
--platforms=macos,linux \
--template=material \
--org=io.github.usernameDisplay the GoFlow CLI version.
goflow version
# or
goflow --version
# or
goflow -vDisplay help information about the CLI and its commands.
goflow help
# or
goflow --help
# or
goflow -hAfter creating a project with goflow create myapp, you'll have:
myapp/
├── lib/ # Shared application code
│ ├── main.go # App entry point (package lib)
│ ├── screens/ # Screen widgets
│ ├── widgets/ # Custom widgets
│ ├── models/ # Data models
│ ├── services/ # Business logic
│ └── state/ # State management
├── macos/ # macOS platform code
│ ├── main.go # Platform runner
│ ├── runner/ # Platform-specific code
│ └── assets/ # Platform assets
├── windows/ # Windows platform code
│ └── ...
├── linux/ # Linux platform code
│ └── ...
├── assets/ # Shared assets
│ ├── fonts/
│ ├── images/
│ └── icons/
├── test/ # Tests
├── go.mod # Go module definition
├── .gitignore
└── README.md
cd myapp
# Run via platform runner (recommended)
cd macos # or windows, or linux
go run main.go
# The platform runner will call lib.Run()cd myapp
# macOS
cd macos
go build -o MyApp
./MyApp
# Windows
cd windows
go build -o myapp.exe
myapp.exe
# Linux
cd linux
go build -o myapp
./myappAfter creating a project, set up dependencies:
cd myapp
# If using local GoFlow (development)
echo "\nreplace github.com/base-go/GoFlow => /path/to/GoFlow" >> go.mod
go mod tidy
# If using published GoFlow (future)
go mod tidyGenerated lib/main.go:
DemoAppstruct with counter signalBuild()method creating UIIncrement()method for interactionsRun()function for platform runners- Spacer helper function
Generated lib/main.go:
- Simple
Appstruct - Basic
Build()method Run()function- No state management
- Ideal for learning
Generated lib/main.go:
MaterialAppwith styled UI- App bar-style header
- Card-like content container
- Counter with Material styling
Run()function
- Must start with a letter
- Can contain letters, numbers, underscores, hyphens
- Will be converted to valid Go identifiers:
my-app→MyApp(type name)todo_list→TodoList(type name)user-auth-service→UserAuthService(type name)
goflow create myapp # ✅ Valid
goflow create my-app # ✅ Valid (becomes MyApp)
goflow create my_cool_app # ✅ Valid (becomes MyCoolApp)
goflow create user-dashboard # ✅ Valid (becomes UserDashboard)
goflow create 123app # ❌ Invalid (starts with number)
goflow create my app # ❌ Invalid (contains space)The CLI is not in your PATH. Either:
- Run from the
cmd/goflowdirectory:./goflow create myapp - Add to PATH:
export PATH=$PATH:/path/to/GoFlow/cmd/goflow - Install globally:
sudo mv goflow /usr/local/bin/
Add a replace directive to use local GoFlow:
cd myapp
echo "\nreplace github.com/base-go/GoFlow => /path/to/GoFlow" >> go.mod
go mod tidyMake sure your lib/main.go has:
package lib(notpackage main)- Exported
Run()function - Valid Go code (no syntax errors)
After creating a project:
- Explore the structure - Understand lib/, platform dirs, and assets/
- Modify lib/main.go - Customize your app's UI and logic
- Run your app - Use platform runners to test
- Add features - Create new widgets, screens, and state
- Build for distribution - Compile platform-specific binaries