Introduction
Hey, DEV friends! π Today, I'd like to introduce a new version of my own project Create Go App CLI, that changes some fundamental things.
π Table of contents
- A new way to install and update CLI
- Switch from my own realization for embed files to built-in feature in Go 1.16.x
- Switch from Taskfile.yml to simple
Makefile
s - Add support for Apple Silicon CPUs
A new way to install and update CLI
Since v1.7.0
, I dropped support Golang versions 1.11.x
, 1.12.x
, 1.13.x
, 1.14.x
and 1.15.x
. A minimal Go version for build CLI from a source is now 1.16.x
(and higher). Therefore, old way to install by go build -i ...
command isn't relevant.
Please, use this command to install or update to a latest version:
go install -ldflags="-s -w" github.com/create-go-app/cli@latest
Next, just rename binary, like this:
mv $GOPATH/bin/cli $GOPATH/bin/cgapp
Also, macOS and GNU/Linux users available way to install via Homebrew:
# Tap a new formula:
brew tap create-go-app/cli
# Installation:
brew install create-go-app/cli/cgapp
How to install older versions?
You can do it by using a version suffix in go install
command:
# With an indication of the exact versions:
go install github.com/create-go-app/cli@1.6.0
Don't forget to rename binary after installation, according to the version you have installed! This must be done to avoid confusion with the latest version.
For example:
mv $GOPATH/bin/cli $GOPATH/bin/cgapp_v1_6_0
And run it by cgapp_v1_6_0 [COMMAND]
.
βοΈ Found all available CLI versions on pkg.go.dev page.
Roadmap for improve this process
- TODO: Add version for Snapcraft (for GNU/Linux users).
- TODO: Add version for Scoop (for MS Windows users).
It would be great to read in the comments about what other installation method would be convenient for you! π
Switch from my own realization for embed files to built-in feature in Go 1.16.x
Previously, to implement embedded configuration files, I used this method I described in this article in great detail:
The easiest way to embed static files into a binary file in your Golang app (no external dependencies)
Vic ShΓ³stak γ» Jan 31 '20
But, a new package embed in Golang 1.16.x
standard library, can do it natively, with a maximum smooth and fully DX (developer experience). So, personally, I was very much looking forward to this opportunity and immediately took advantage of it!
π Look at how much easily this code looks now and how it looked in the past. At the same time, this code performs the same function: it adds the config files to the binary. How magical it is!
Switch from Taskfile.yml to simple Makefile
s
Yes, I thought I could replace the good old Makefile
with some modern solution for automating commonly used commands for a project... but I was wrong! So, I made the willful decision to go back to the roots.
In this version (and later), support for Taskfile will be dropped throughout the Create Go App project (both in the CLI and in production-ready templates).
Make a
make run
not atask run
now.
I say "thank you" to the developers of this tool, but habit is much stronger! π
Add support for Apple Silicon CPUs
Now, in assets of every release (at GitHub repository), I put special binary version for beautiful working Create Go App CLI on the Mac computers with Apple-designed processors (M1
and higher).
Wikipedia: The M1 chip, Apple's first processor designed for use in Macs, is manufactured using TSMC's 5 nm process. It was announced on November 10, 2020, and is used in the M1 MacBook Air, Mac mini, and MacBook Pro (2020).
Photos by
- Tim Mossholder https://unsplash.com/photos/H6eaxcGNQbU
P.S.
If you want more articles (like this) on this blog, then post a comment below and subscribe to me. Thanks! π»
βοΈ You can support me on Boosty, both on a permanent and on a one-time basis. All proceeds from this way will go to support my OSS projects and will energize me to create new products and articles for the community.
And of course, you can help me make developers' lives even better! Just connect to one of my projects as a contributor. It's easy!
My main projects that need your help (and stars) π
- π₯ gowebly: A next-generation CLI tool that makes it easy to create amazing web applications with Go on the backend, using htmx, hyperscript or Alpine.js and the most popular CSS frameworks on the frontend.
- β¨ create-go-app: Create a new production-ready project with Go backend, frontend and deploy automation by running one CLI command.
Top comments (0)