GithubHelp home page GithubHelp logo

ubume's Introduction

Build reviewdog Go Report Card
[日本語]

ubume - Golang project template generator

ubume command generate golang project template at current directory. The following three projects can be created.

  • Application project
  • Library project
  • Command Line Interface project with cobra

The automatically generated files include "Makefile for easy project management" and "GitHub Actions files (build, unit test, review-dog, goreleaser, dependabot)". However, it does not run "$ git init".

Screenshot

How to install

Step.1 Install golang

If you don't install golang in your system, please install Golang first. Check the Go official website for how to install golang.

Step2. Install ubume

$ go install github.com/nao1215/ubume/cmd/ubume@latest

How to use

Generate application project

In the following example, the ubume command will generate a sample project. The binary name will be sample, and build using Makefile.

$ ubume github.com/nao1215/sample  ※ Argument is same as "$ go mod init"
ubume starts creating the 'sample' application project (import path='github.com/nao1215/sample')

[START] check if ubume can create the project
[START] create directories
[START] create files
        sample (your project root)
         ├─ CODE_OF_CONDUCT.md
         ├─ Makefile
         ├─ Changelog.md
         ├─ .goreleaser.yml
         ├─ cmd
         │  └─ sample
         │     ├─ main.go
         │     ├─ main_test.go
         │     └─ doc.go
         └─ .github
            ├─ dependabot.yml
            ├─ ISSUE_TEMPLATE
            │  ├─ issue.md
            │  └─ bug_report.md
            └─ workflows
               ├─ reviewdog.yml
               ├─ build.yml
               ├─ unit_test.yml
               └─ release.yml
[START] Execute 'go mod init github.com/nao1215/sample'

BUILD SUCCESSFUL in 6[ms]

$ cd sample
$ make build
$ ls
Changelog.md  Makefile  cmd  go.mod  sample

$ ./sample 
Hello, World

$ make test
env GOOS=linux go test -v -cover ./... -coverprofile=cover.out
=== RUN   TestHelloWorld
--- PASS: TestHelloWorld (0.00s)
PASS
coverage: 50.0% of statements
ok      github.com/nao1215/sample/cmd/sample    0.001s  coverage: 50.0% of statements
go tool cover -html=cover.out -o cover.html

Generate library project

$ ubume --library github.com/nao1215/sample
ubume starts creating the 'sample' library project (import path='github.com/nao1215/sample')

[START] check if ubume can create the project
[START] create directories
[START] create files
        sample (your project root)
         ├─ sample_test.go
         ├─ CODE_OF_CONDUCT.md
         ├─ Makefile
         ├─ Changelog.md
         ├─ doc.go
         ├─ sample.go
         └─ .github
            ├─ dependabot.yml
            ├─ ISSUE_TEMPLATE
            │  ├─ issue.md
            │  └─ bug_report.md
            └─ workflows
               ├─ reviewdog.yml
               └─ unit_test.yml
[START] Execute 'go mod init github.com/nao1215/sample'

BUILD SUCCESSFUL in 3[ms]

Self-documented Makefile

The Makefile generated by the ubume command is self-documenting. When you run the make command, you will see the target list that exists in the Makefile. A help message is showed next to the target name.

$ make
build           Build binary 
clean           Clean project
fmt             Format go source code 
test            Start test
vet             Start go vet

If you want to add a new target, please comment with "##" next to the target. The string after "##" is extracted and used as a help message. An example is shown below.

build:  ## Build binary 
	env GO111MODULE=on GOOS=$(GOOS) $(GO_BUILD) $(GO_LDFLAGS) -o $(APP) cmd/sample/main.go

clean: ## Clean project
	-rm -rf $(APP) cover.out cover.html

Contact

If you would like to send comments such as "find a bug" or "request for additional features" to the developer, please use one of the following contacts.

LICENSE

The ubume project is licensed under the terms of the Apache License 2.0.

ubume's People

Contributors

dependabot[bot] avatar nao1215 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.