You need to enable JavaScript to run this app.
Volcano Engine Function as a Service

Volcano Engine Function as a Service

Copy page
Download PDF
Golang runtime
Deployment methods
Copy page
Download PDF
Deployment methods
Golang functions only support uploading code as ZIP packages. You can either upload a local ZIP file or specify an existing ZIP file in your TOS bucket for upload. The ZIP package must contain a compiled binary file named main that can be executed on the amd64-based Linux platform.​
Golang functions support cross-platform compilation by specifying the GOOS and GOARCH parameters. The compilation and packaging methods for Golang functions on different platforms are as follows.​
macOS or Linux platforms​
On macOS or Linux, you can compile and package the code by running the following commands.​
​
# Build your program that's executable for Linux under architecture amd64.​
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main​
# Zip output.​
zip main.zip main​
​
Windows platforms​
On Windows, follow these steps to compile and package the code:​
  1. Press the shortcut keys Windows + R to open the Run dialog, then type wt to open the command-line terminal.​
  1. Compile using the following command.​
  • ​
    set GOOS=linux​
    set GOARCH=amd64​
    set CGO_ENABLED=0​
    go build -o main​
    ​
  1. Use a packaging tool to package the compiled binary main. The main file must be located in the root directory of the ZIP package.​
Considerations​
  • The compiled binary must be named main, and the main file must reside in the root directory of the ZIP package rather than in any subdirectory.​
  • If your main program depends on other local files (for example, config.yaml), include these dependencies in the package and reference them via relative paths in your code.​
  • The size of ZIP files uploaded to the veFaaS console must not exceed 256 MiB. If the ZIP file size exceeds 256 MiB, submit a ticket for technical support.​
​
Last updated: 2026.08.19 14:06:05