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> --owner <owner> [flags]
# Add remote to existing local project
gonew add-remote <project-path> --owner <owner> [flags]| Flag | Description | Default |
|---|---|---|
--owner |
GitHub owner/organization (-owner also works) |
Required. Never guessed: without it gonew stops and changes nothing |
-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" --owner webtypgonew my-lib "Go library" -owner=cdvelop
gonew my-tool "CLI tool" -owner=veltylabs -visibility=private
gonew webapp "Web app" -owner=webtypgonew my-lib "Go library" --owner webtyp -visibility=privategonew my-tool "CLI tool" --owner webtyp -local-onlygonew add-remote ./my-project --owner webtyp -visibility=public
gonew add-remote ./my-project -owner=webtyp -visibility=private- Strict Validation: Enforces valid repository names and descriptions.
- Explicit owner: the GitHub owner is always given with
--ownerand never guessed fromgh, git or neighbor folders (a neighbor left on an old organization once made gonew try to createwebtyp/backoff). Generates an MIT license by default. - Multi-Account Support: Use
--ownerto specify different GitHub accounts/organizations (cdvelop, veltylabs, webtyp, 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.