Initialize new Go projects with standard devflow structure.
gonew automates the creation of Go projects, handling:
- Local git initialization
- Remote GitHub repository creation (optional)
- Go module initialization
- Template file generation (README, LICENSE, .gitignore, etc.)
- Initial commit and tagging
graph TD
A[Start gonew] --> B{Local binary checks}
B --> C{Remote requested?}
C -- Yes --> D[Check/Create GitHub Repo]
C -- No --> E[Local Only Mode]
D --> F{Success?}
F -- No --> E
F -- Yes --> G[Local+Remote Mode]
E --> H[Create Directory]
G --> H
H --> I[Git Init]
I --> J[Generate README/LICENSE/etc]
J --> K[Go Mod Init]
K --> L[Initial Commit]
L --> M[Create Tag v0.0.1]
M --> N{Is Remote?}
N -- Yes --> O[Add Remote & Push]
N -- No --> P[✅ Done]
O --> P
# Create new project
gonew <repo-name> <description> [flags]
# Add remote to existing local project
gonew add-remote <project-path> [flags]| Flag | Description | Default |
|---|---|---|
-owner |
GitHub owner/organization | Auto-detected from gh or git config |
-visibility |
Repository visibility (public or private) |
public |
-local-only |
Skip remote repository creation | false |
-license |
License type | MIT |
gonew my-project "A sample Go project"gonew my-lib "Go library" -owner=cdvelop
gonew my-tool "CLI tool" -owner=veltylabs -visibility=private
gonew webapp "Web app" -owner=tinywasmgonew my-lib "Go library" -visibility=privategonew my-tool "CLI tool" -local-onlygonew add-remote ./my-project -visibility=public
gonew add-remote ./my-project -owner=tinywasm -visibility=private- Strict Validation: Enforces valid repository names and descriptions.
- Smart Defaults: Auto-detects git user and GitHub owner, generates MIT license.
- Multi-Account Support: Use
--ownerto specify different GitHub accounts/organizations (cdvelop, veltylabs, tinywasm, etc.). - Graceful Fallback: Falls back to local-only mode if GitHub is unavailable.
- Project Structure: Sets up
mainbranch,.gitignorefor Go, and initial versionv0.0.1.