it is a tool for managing the go environment and project
go get -u github.com/go-rut/gorut
cd ${GOPATH}/src/github.com/go-rut/gorut
go build
mv gorut /usr/local/bin/
Or build by Makefile
make
NAME:
gorut - it is a tool for managing the go environment and project
USAGE:
gorut [global options] command [command options] [arguments...]
VERSION:
0.0.3
AUTHOR(S):
Henry Huang <[email protected]>
COMMANDS:
init Initial go environment and go source path
create Create a new project
deps Get dependence of the project
go Run command go - link go: ./gorut go [go_subcommand args]
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
Key | Information | Sample |
---|---|---|
project | Path: github.com/go-rut; ProjectName: gorut_test | github.com/go-rut/gorut/example/gorut_test |
gopath | Go Source Path | /Users/henryhuang/code/golang |
cgo_enabled | C Go Enabled Flag | true or false |
deps | Project Dependences | Support Git or Go |
gorut init
It will create go source path
- $gopath/src
- $gopath/pkg
- $gopath/bin
Key | Information |
---|---|
-f | if it is true, it will delete the old project, then create an new project |
-t | create the project with template, default is null. buildin: ddd, ddd_sample, ddd_isolator |
If create an new project like this:
gorut create
It will create an new project (ProjectPath: $gopath/src/github.com/go-rut/gorut_test) without any code.
If create an new ddd project like this:
gorut create -f -t=ddd
It will create an new project (ProjectPath: $gopath/src/github.com/go-rut/gorut_test) without code.
But it has ddd directories:
$ProjectPath/common/
$ProjectPath/conf/
$ProjectPath/docs/
$ProjectPath/domain/
$ProjectPath/services/
$ProjectPath/models/
$ProjectPath/repository/
$ProjectPath/repository/repo
If create an new ddd project like this:
cd example
gorut create -f -t=ddd_sample
It will create project (ProjectPath: $gopath/src/github.com/go-rut/gorut_test) with ddd sample code.
It depends on github.com/gogap/isolator, if create an new ddd project like this:
cd example
gorut create -f -t=ddd_isolator
It will create project (ProjectPath: $gopath/src/github.com/go-rut/gorut_test) with ddd isolator code.
If you have other good practice, write your template into tpl path.
Your struct must be GoRutTemplate:
type GoRutTemplate interface {
Create() error
}
mv gorut.conf /Users/henryhuang/code/golang/src/github.com/go-rut/gorut/example/gorut_test/
- command : gorut go
- Run gorut go - link go: go go_subcommand [args]
cd gorut_test/
gorut go run main.go
If your project need dependences, you can write into config. It Supported Git And Go.
gorut deps
It will get dependences like this: