• Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
James Thomas

OpenWhisk Serverless Boilerplate example in Go

by

This example shows a Serverless boilerplate in Go.

  1. OpenWhisk Serverless Boilerplate example in Go

Serverless Boilerplate - OpenWhisk - Go

Make sure serverless is installed. See installation guide.

You will also need to set up your OpenWhisk account credentials using environment variables or a configuration file. Please see the this guide for more information.

1. Install Project Dependencies

npm install in this directory to download the modules from package.json.

2. Compile Go Binary

$ env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w -extldflags "-static"' handler.go

3. Deploy

serverless deploy or sls deploy. sls is shorthand for the Serverless CLI command

Serverless: Packaging service...
Serverless: Compiling Functions...
Serverless: Compiling API Gateway definitions...
Serverless: Compiling Rules...
Serverless: Compiling Triggers & Feeds...
Serverless: Deploying Functions...
Serverless: Deployment successful!

Service Information
platform:	openwhisk.ng.bluemix.net
namespace:	_
service:	go-service

actions:
go-service-dev-greeting

4. Invoke deployed function

serverless invoke --function greeting or serverless invoke -f greeting

-f is shorthand for --function

In your terminal window you should see the response from Apache OpenWhisk

$ serverless invoke -f greeting
{
    "msg": "Hello stranger!"
}
$ serverless invoke -f greeting -d '{"name": "James"}'
{
    "msg": "Hello James!"
}

For more information on the Serverless OpenWhisk plugin, please see the project repository: https://serverless.com/framework/docs/providers/openwhisk/guide/credentials/.

Contents

  • Serverless Boilerplate - OpenWhisk - Go
  • 1. Install Project Dependencies
  • 2. Compile Go Binary
  • 3. Deploy
  • 4. Invoke deployed function

Related

GuidesPluginsExamplesSlack CommunitySupport