Hi there.
I’ve just started using Hugo last week, and I spent a few days putting together a site using 0.113.0 extended locally, using VS code with WSL2, working with modules, making sure it all worked locally, troubleshooting, etc. We have a pretty nice site if I do say so myself, and it all runs really well locally.
I went to deploy this afternoon on DigitalOcean using App Platform and ran into an issue. I’m pretty sure I’m not to blame, because the same site deploys on Cloudflare Pages - except Cloudflare Pages doesn’t support Hugo extended, so none of the fancy stuff works.
The problem is that if I deploy from the Github repo with the go.mod file in the repo, App Platform doesn’t recognise the deployment as Hugo, just as a Go deployment and uses the Go Buildpacks. I get this in the logs:
[2023-06-19 11:21:30] ╭──────────── app build ───────────╼
[2023-06-19 11:21:33] │ -----> Fetching jq... done
[2023-06-19 11:21:34] │ -----> Fetching stdlib.sh.v8... done
[2023-06-19 11:21:34] │ ----->
[2023-06-19 11:21:34] │ Detected go modules via go.mod
[2023-06-19 11:21:34] │ ----->
[2023-06-19 11:21:34] │ Detected Module Name: github.com/robotsmakegames/robotsmakegames.com
[2023-06-19 11:21:34] │ ----->
[2023-06-19 11:21:34] │ -----> New Go Version, clearing old cache
[2023-06-19 11:21:34] │ -----> Installing go1.17.13
[2023-06-19 11:21:59] │ -----> Fetching go1.17.13.linux-amd64.tar.gz... done
[2023-06-19 11:22:00] │ -----> Determining packages to install
[2023-06-19 11:22:00] │ go: warning: "./..." matched no packages
[2023-06-19 11:22:00] │ !!
[2023-06-19 11:22:00] │ !! No main packages found in module github.com/robotsmakegames/robotsmakegames.com
[2023-06-19 11:22:00] │ !!
[2023-06-19 11:22:00] │ !! Unsure what package(s) to install, defaulting to '.'
[2023-06-19 11:22:00] │ !!
[2023-06-19 11:22:00] │ !! Installing package '.' (default)
[2023-06-19 11:22:00] │ !!
[2023-06-19 11:22:00] │ !! To install a different package spec add a comment in the following form to your `go.mod` file:
[2023-06-19 11:22:00] │ !! // +heroku install ./cmd/...
[2023-06-19 11:22:00] │ !!
[2023-06-19 11:22:00] │ -----> Running: go install -v -tags heroku .
[2023-06-19 11:22:00] │ no Go files in /workspace
[2023-06-19 11:22:00] │ ERROR: failed to build: exit status 1
[2023-06-19 11:22:00] │
[2023-06-19 11:22:00] │
[2023-06-19 11:22:00] │ For documentation on the buildpacks used to build your app, please see:
[2023-06-19 11:22:00] │
[2023-06-19 11:22:00] │ Go v0.172.4 https://do.co/apps-buildpack-go
[2023-06-19 11:22:00] │
[2023-06-19 11:22:00] │ ✘ build failed
However, obviously, if I build without go.mod, then App Platform picks up config.yaml, recognises it as a Hugo projects, brings in the Hugo Buildpacks but spits out the error about the module being missing. Which is correct behaviour. I know that much.
Unfortunately, I’m not very familiar with any of this, and that goes for App Platform too. I just took a few days out to learn it to set the site up. Is this a DO problem, and if it is, does anyone know a workaround for this? Or is this just a me problem I’m not able to identify? It seems like App Platform just sees go.mod and tries to use the Go Buildpacks and fails.
Again, site is working locally, so a workaround would be to set up a Droplet and maybe do it that way - but then I lose the CD aspect of App Platform that’s really attractive. I definitely don’t know enough to use DOCR or a Docker image comfortably.
Thanks for reading.