Back

Can't make Function in Go work

  • 0
  • Functions
  • Cloud
handset7526
6 Feb, 2025, 12:44

I've tried everything, using workspaces, modules, symbolic links, binaries, using the root of repo and "cd" to the function but it always fails becaise git is not installed or something weird with the build.

I'm trying to have a common folder in the root with shared code and various functions inside the "functions" folder. Essentially I want a mono repo with shared code between functions. No matter what I do or which configuration, nothing works.

Did someone manage to achieve this?

Also it seems based on the "appwrite.json" there's no way to tell appwrite to download the root and cd to the function folder as it seems it is only possible when you connect Git and if you do not only it selects 1 CPU (which is not avaialbe on the free tier) but if you change the json it removes the git connection.

When I download the root and tell go to use the common folder either using mod or workspaces.

TypeScript
Preparing for build ...
Building ...
Compiling ...
go: openruntimes/handler@v0.0.0 (replaced by /usr/local/build): reading ../../build/go.mod: open /usr/local/build/go.mod: no such file or directory
TL;DR
Developers are having trouble making a shared code structure work in Go functions due to issues with Git and configurations. The error message points to a problem with the go.mod file. One solution could be ensuring that the path to the module is set correctly in the go.mod file.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more