Run a golang binary from a pipeline?

I’m trying to call a golang binary that’s versioned in the repo from a bash script that runs in CI. The output when it’s run is

./coverage-reporter: line 2: syntax error: unexpected ")"

This tells me maybe it’s trying to run the binary as a bash script because it doesn’t recognize the binary as executable. I tried echoing uname -m to see the machine architecture, but it didn’t log out in the pipeline output for some reason.

The binary just takes a couple of values and makes an API request with them to post them somewhere. It works without issue on my x86_64 machine (OS X).

Is what I’m trying to do possible?


running a Golang binary from CI/CD is possible, there a few limitations though, e.g. when the job which built the binary is a different platform/architecture to the job which executes the binary. For example, a Linux built binary does not work on macOS. Can you share the full CI/CD configuration and building scripts to get an idea what to propose next?


That was exactly the problem. I’d compiled it for the wrong architecture. I can confirm that compiling it for Linux fixed the issue. Thanks!

:: Sent from my mobile device ::

1 Like