All Projects → IBM-Cloud → go-hello-world

IBM-Cloud / go-hello-world

Licence: Apache-2.0 license
A Hello World app using Golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

#Go Hello World Overview

This app is a hello world plus a little big of basic functionality using Golang. The application uses Gin-Gonic for the app router and for templating.

Also check out a blog post on this topic as well for a more in depth look at Go and Gin-Gonic.

Build Status

Build Status Bluemix Deployments

Running the app on Bluemix

You can deploy your own instance of Go Hello World app to Bluemix. To do this, you can either use the Deploy to Bluemix button for an automated deployment or follow the step below to create and deploy your app manually.

Deploy to Bluemix

  1. Install Go. If you have Go installed skip to step 2.

  2. Create a Bluemix Account

    Sign up for Bluemix or use an existing account.

  3. Download and install the Cloud Foundry CLI tool

  4. cd into the $GOPATH/src directory

cd $GOPATH/src
  1. Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/IBM-Bluemix/go-hello-world.git
  1. cd into this newly created directory
cd go-hello-world
  1. Compile the Go code:
$ make
  1. Open the manifest.yml file and change the host value to something unique

The host you choose will determinate the subdomain of your application's URL: <host>.mybluemix.net

  1. Connect to Bluemix in the command line tool and follow the prompts to log in:
$ cf api https://api.ng.bluemix.net
$ cf login
  1. Deploy your app to Bluemix:
$ cf push

And voila! You now have your very own instance of the Go Hello World app running on Bluemix.

Run the app locally

  1. Install Go. If you have Go installed skip to step 2.

  2. cd into the $GOPATH/src directory

cd $GOPATH/src
  1. Clone the app to your local environment from your terminal using the following command:
git clone https://github.com/IBM-Bluemix/go-hello-world.git
  1. cd into this newly created directory
cd go-hello-world
  1. Compile the Go code:
$ make

Your app will be automatically be available on port 8080. To access the app, go to localhost:8080 in your browser. Happy developing!

Contribute

We are more than happy to accept external contributions to this project, be it in the form of issues and pull requests. If you find a bug, please report it via the Issues section or even better, fork the project and submit a pull request with your fix! Pull requests will be evaulated on an individual basis based on value add to the sample application.

Troubleshooting

The primary source of debugging information for your Bluemix app is the logs. To see them, run the following command using the Cloud Foundry CLI:

$ cf logs go-hello-world --recent

For more detailed information on troubleshooting your application, see the Troubleshooting section in the Bluemix documentation.

Privacy Notice

The go-hello-world sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:

  • Application Name (application_name)
  • Space ID (space_id)
  • Application Version (application_version)
  • Application URIs (application_uris)

This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.

Disabling Deployment Tracking

To disable deployment tracking for this app remove the following 2 lines line 5 and line 13 in go-hello-world.go

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].