In its version 1.18, Go introduced Workspaces to use multiple modules in the same project easier. This repository contains an application (in the cmd/
folder) relying on two Go Modules declared in the go.work
file. To try by yourself, you'll need a Clever Cloud account and our CLI, Clever Tools (you can also use our Console).
The easier way to install it is through npm
(but there are lots of other ways):
npm i -g clever-tools
clever login
clever profile
Then git clone
this repository and follow our deploy instructions:
git clone https://github.com/CleverCloud/go-workspaces.git
cd go-workspaces
This repository contains a Makefile
. So you just have to create a Go application on your account, declare where is the built binary through CC_GO_BINARY
environment variable and git push
!
clever create -t go
clever env set CC_GO_BINARY bin/myApp
git add . && git commit -m "First commit"
clever deploy && clever domain
After that, your application should be built and deployed. Just type its URL in your browser!
If you prefer to rely on environment variables, delete Makefile
. The create process is this time followed by env vars declaration:
clever create -t go
clever env set CC_GO_BUILD_TOOL "gomod"
clever env set CC_GO_PKG "cmd/main.go"
git add . && git commit -m "First commit"
clever deploy && clever domain