Skip to content

Commit

Permalink
Merge pull request #24 from kcmvp/gogit
Browse files Browse the repository at this point in the history
#23: remove go-git dependency and remove unused resources
  • Loading branch information
kcmvp authored Dec 26, 2023
2 parents a0edcab + 571ff87 commit 204b819
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 166 deletions.
69 changes: 63 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,75 @@ Golang Project Boot
## Introduction
Although the Golang programming ecosystem is becoming more and more mature,
these tools and frameworks exist independently to solve specific problems.
Whenever a new Golang project is started, it requires a series of installations、different command execution
to complete daily project development work;
What’s worse is that whenever your switch the development environment, the same work has to be repeated!
Whenever a new Golang project is started, it requires a series of initialization;
What’s worse is that whenever your switch the development environment, same process have to be repeated!
This project is built to solve this problem by providing a method similar to [Maven](https://maven.apache.org/) or [Gradle](https://gradle.com/) in the **Java** ecosystem.

<span id="nav-3"></span>

## Installation
Run below command to install this tool
## Features

**Everything is a plugin !**

You just need to use **three** commands to achieve whatever you want

1. Initialization project with
```shell
gob init
```
2. Install a tool as a plugin
```shell
gob install github.com/golangci/golangci-lint/cmd/golangci-lint lint
```
- This command install the **latest** [golangci-lint](https://golangci-lint.run/) as a plugin with alias **lint**
- You can also install a tool with specified version as
```shell
gob install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0 lint
```
- Compare to go default ```go install```, gob support multiple version tool installation. eg
```shell
ls -althr golangci-lint-v1.55*
-rwxr-xr-x@ 1 kcmvp staff 40M Dec 25 16:08 golangci-lint-v1.55.1
-rwxr-xr-x 1 kcmvp staff 41M Dec 25 16:10 golangci-lint-v1.55.0
```
This will make your project is build with constant tools set

3. Execute the tool as a gob plugin(execute golangci-lint)
```shell
gob lint
```
4. Run `gob -h` get comprehensive and beauty help information


## Quick Start
- Install `gob` with below command
```go
go install github.com/kcmvp/gob
go install github.com/kcmvp/gob
```
- Navigate to project directory, initialize project with below command
```go
gob init
```
This command will create a configuration named `gob.yaml` in the project root directory as below:
```yaml
exec:
commit-msg-hook: ^#[0-9]+:\s*.{10,}$
pre-commit-hook:
- lint
- test
pre-push-hook:
- test
plugins:
golangci-lint:
alias: lint
command: run, ./...
url: github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.1
```
1. The `exec` section is designed to be executed by external; the `init` command will setup three
git local hook: `commit-msg-hook`, `pre-commit-hook` and `pre-push-hook`
2. The `plugins` section define all the plugins(tools) used by this project. **Any tool can be installed as a gob plugin**,
`init` command would install [golangci-lint](https://golangci-lint.run/) as a gob `plugin`

## Features
This tool supply comprehensive help message, you can always get detail information & usage of each command by **-h** flag
The main features mainly categorize as below
Expand Down
24 changes: 0 additions & 24 deletions cmd/resources/commit_msg.tmpl

This file was deleted.

16 changes: 0 additions & 16 deletions cmd/resources/setup.json

This file was deleted.

24 changes: 3 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.21.4

require (
github.com/fatih/color v1.16.0
github.com/go-git/go-git/v5 v5.10.1
github.com/jedib0t/go-pretty/v6 v6.4.9
github.com/samber/lo v1.38.1
github.com/spf13/cobra v1.8.0
Expand All @@ -13,50 +12,33 @@ require (
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 204b819

Please sign in to comment.