Attempting to deploy go exe to my functions

Hello,

I am attempting to deploy a function. This is something I always seem to struggle with.

I have successfully deployed a javascript function in the past and this is working fine (I do this by running netlify functions:build locally and pushing the .zip to my github repo)

Now I have compiled an exe with go (my GOOS is set to linux) and placed this in the same functions directory as the zip of my javascript function.

When I trigger a deployment, nothing seems to happen with my executable.

Is it possible that an error in the code (this is very likely) prevents deployment, I had assumed not.
Or am I deploying my binary wrong?

my site is:
loving-bartik-b12149.netlify.app

here is the deploy log:
https://pastebin.com/sRhhzMAa

Hey @rpcutts,
Deploying Go functions is… not the most straightforward! Here’s a netlify.toml for a Go function called “parse.go” that lives in a folder called “functions”:

You need:

  • GO_IMPORT_PATH either in netlify.toml or Netlify UI
  • the command to go into the directory that holds your Go function and compile it, something like: "go get ./functions/... && go build -o functions/parse ./functions/parse.go"

Note in the example I shared that the “functions” directory holds a Go function and a JS function. As long as you declare

functions = "WHATEVER_YOUR_FUNCTION_DIR_NAME_IS"

in your netlify.toml, Netlify will automatically build the Javascript functions in that directory. But you have to include a separate command to build your Go function.

Wanna give this a shot and let us know if you run into errors or have any other questions?

Thank you @jen

I ended up finding a different solution for what I was doing, but will need to do this in the future, no doubt.

So thanks for these details, I will make a note of them.

Hey @rpcutts, glad to find that you conjured a solution!