command module
Version: v0.0.0-...-6602e1f Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2016 License: BSD-2-Clause Imports: 17 Imported by: 0


Build Status

Gonew V2

This is Gonew V2. It improves on Gonew Classic by providing a more flexible configuration and a vastly simpler code base. If you are migrating from Gonew Classic, see the migration guide (MIGRATION.md).

About gonew

Gonew is a tool for stubbing out new golang projects.


Detailed usage and configuration information is on godoc.org.

Help out

If you want to add more licence templates or improve existing templates please create a new issue. I'm always open to ideas regarding template improvement. But be warned that I will scrutenize these ideas and reject some. The generality of Gonew's templating system allows users to create and use custom template sets. The guideline for altering Gonew's default templates is this:

Content generated by Gonew's default templates should follow all commonly accepted best-practices for their respective file types.

Any changes to gonew's templates should result in for greater adherence to this principle.


Bryan Matsuo (YotpoLtd)

Copyright (c) 2011, Bryan Matsuo. All rights reserved.

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.



Gonew generates new Go projects. The produced projects contain stub files and can optionally initialize repositories and add files to them.


gonew [options] project target


project: The type of project to generate
target: The name from which filenames are based


-config="": specify config path
-env="": specify a user environment
-pkg="": specify a package name


gonew pkg go-mp3lib
gonew -pkg mp3lib lib decode
gonew cmdtest goplay


Gonew is configured via a JSON file stored in ~/.config/gonew.json. An example can be found in gonew.json.example The configuration file specifies environments, projects, and the locations of externally defined templates. An environment holds information used in template rendering like user metadata and import paths for created projects. A project configuration describes the files contained in a project and script hooks to execute on file creation. Environments can inherit/override other environments and projects can inherit/override from other projects.

Custom Templates

Users can define their own set of custom templates. This is done by adding entries to the ExternalTemplates array in the configuration file. Templates can make use of the standard gonew templates (in the "templates" directory). Templates must have the .t2 file extension to be recognized by Gonew.

Template Functions

Templates in Gonew have acces to a small library of helper functions Here is list of all available template functions.

name: the user's name specified in the environment
email: the user's email specified in the environment
year: the year in 4-digit format

Source Files


Path Synopsis
The templating system for gonew (v2).
The templating system for gonew (v2).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL