Error in deployment
adriansantaella opened this issue · 5 comments
Fairly new to Go so I could be doing something wrong, but I'm attempting to deploy to Vercel and getting an error:
Error: Could not find an exported function in "api/vendor/github.com/PuerkitoBio/goquery/array.go"
I've also tried on Netlify and seem to get a similar error, always with this repo. I had the files structured differently, but the error I got on Netlify was this:
../vendor/github.com/PuerkitoBio/goquery/iteration.go:3:8: cannot find package "." in: /opt/build/repo/netlify/functions/vendor/iter
I'm using Go 1.23 and goquery 1.10
Hello Adrian,
I'm not familiar with the Go deployment flow of those services, but is your app open-source? Otherwise can you share your go.mod
file? I can run a new program without issue locally with Go1.23 with goquery 1.10 as a dependency, just doing go mod tidy
to install the dep.
Martin
Hi Martin,
I can run it and build it locally, I've run go mod tidy
and go mod vendor
as well. For Vercel the deployment, specifically, I had to manipulate the file for their serverless function as per their instructions. Even Netlify had specific instructions. I'm posting my go.mod file below. You are welcome to take a look at the repo, it's just something I'm fiddling with to get my feet wet. I just made the repo public.
Is there a deployment solution you recommend?
Thanks for the additional info. I’m sure those deployment options usually work fine. Just wondering, do they specifically require you to vendor the deps? That’s an unusual thing to see these days in Go, I’m thinking this could be causing some weirdness. Also, would be good to see if they explicitly support Go 1.23, which is relatively new. If not you’d need to set Go 1.22 in your go.mod file and ensure you use the 1.9.x version of goquery.
Those are the two things I can think of!
Your suggestion worked! I removed the vendor files and downgraded Go to 1.22.7 and goquery to 1.9.3 and the build deployed.
Thanks
Awesome, glad it worked. Have fun!