An open API service indexing awesome lists of open source software.

https://github.com/bench/generator-go

A Yeoman generator to scaffold a simple golang application
https://github.com/bench/generator-go

golang javascript scaffold yeoman

Last synced: 2 months ago
JSON representation

A Yeoman generator to scaffold a simple golang application

Awesome Lists containing this project

README

          




# A non-opinionated golang code generator

A [Yeoman](http://yeoman.io) generator for the [golang](http://golang.org/) programming language.

### What is golang ?

See the [Golang documentation](https://golang.org/doc/)

### Why a generator ?

The Golang team defined [guidelines](https://blog.golang.org/organizing-go-code) 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
```

2. Install the generator

```
$ npm install generator-go
```

3. 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.


CURRENT FOLDER
├── go.mod
├── hello
│ ├── hello.go # source file
│ └── hello_test.go # test file
├── main.go # app entrypoint
├── Makefile # build targets
└── README.md

Once built, you can run your application

```
$ make run
```

Compile sources and build binary

```
$ make install
```

Run all tests

```
$ make test
```

And clean up the binary

```
$ make clean
```

## How to contribute

1. Fork the project

2. Clone your forked project locally

```
$ git clone https://github.com/your_repo/generator-go.git
$ cd generator-go
```

3. Modify sources

4. Symlink the package folder

```
$ sudo npm link
```

5. Test your generator

```
$ yo go
```

6. Submit a pull request

This project welcomes all contributors, feel free to apply !

## Dependencies

This project depends on

* [golang](http://golang.org/)
* [Yo](https://github.com/yeoman/yo) (the scaffolding tool from Yeoman)
* [GNU make](https://www.gnu.org/software/make/manual/make.html)