/generator-go

A Yeoman generator to scaffold a simple golang application

Primary LanguageJavaScriptMIT LicenseMIT

A non-opinionated golang code generator

A Yeoman generator for the golang programming language.

What is golang ?

See the Golang documentation

Why a generator ?

The Golang team defined guidelines to organize code and structure an application.

The generator builds a standard directory hierarchy complying with those guidelines.

Usage

  1. Install yeoman
$ npm install -g yo
  1. Install the generator
$ npm install generator-go
  1. Run the generator
$ yo go

That's all folks !

This will generate a minimalist directory hierarchy, a makefile and a .gitignore in your $GOPATH folder.

$GOPATH folder
└── src
    └── github.com
        └── myapp
            ├── hello
            │   ├── hello.go       # source file
            │   └── hello_test.go  # test file
            ├── main.go            # app entrypoint
            ├── Makefile
            ├── README.md
            └── .gitignore

Once built, go into application folder. You can then

Run your application with

$ make run

Compile sources and build binary with

$ make install

Run all tests suite with

$ make test

And clean up with

$ make clean

How to contribute

  1. Fork the project

  2. Clone your forked project locally

$ sudo git clone https://github.com/your_repo/generator-go.git
$ cd generator-go
  1. Modify sources

  2. Symlink the package folder

$ sudo npm link
  1. Test your generator
$ yo go
  1. Submit a pull request

This project welcomes all contributors, feel free to apply !

Dependencies

This project depends on