Creating a Granitic project

The grnc-project tool

Granitic includes a command line utility called grnc-project that automates the creation of new Granitic projects that can be immediately built and started. You can build this tool by running:

  go install

As long as your $GOPATH/bin folder is in your $PATH, you will be able to run this tool from any folder

Creating a project

Assuming that you are following the traditional Go approach of creating your projects within your GitHub account, you can create a new project by running:

  cd $GOPATH/
  grnc-project your-project-name

This will create a folder called your-project-name with a skeleton entry point file (service.go), component definition file and configuration file.

Editing the entry point file

If you open your newly created service.go file, you will see a line like:

  import "./bindings"  //Change to a non-relative path if you want to use 'go install'

Which is a workaround to allow projects that are created outside of the normal $GOHOME/src/ location to compile with go build. This workaround is not compatible with go install, however. In the example above you should change this line to:

  import ""

You can avoid this by providing your full package name as a second argument to grnc-project:

  grnc-project your-project-name

Next: Building and running your application

Prev: Anatomy of a Granitic project