{"id":13409601,"url":"https://github.com/kcmvp/gob","last_synced_at":"2025-04-22T11:23:36.153Z","repository":{"id":212904320,"uuid":"725031943","full_name":"kcmvp/gob","owner":"kcmvp","description":"Golang project boot","archived":false,"fork":false,"pushed_at":"2024-04-13T10:09:32.000Z","size":7161,"stargazers_count":7,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-14T00:31:36.179Z","etag":null,"topics":["build-tool","git-hook","git-hooks","multiple-versions","onion-architecture","scaffold"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kcmvp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-29T09:48:46.000Z","updated_at":"2024-06-16T04:20:14.868Z","dependencies_parsed_at":"2023-12-17T07:26:09.286Z","dependency_job_id":"0f5dc373-166b-47bd-bd62-39c9c7eecc12","html_url":"https://github.com/kcmvp/gob","commit_stats":null,"previous_names":["kcmvp/gb","kcmvp/gob"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmvp%2Fgob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmvp%2Fgob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmvp%2Fgob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcmvp%2Fgob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcmvp","download_url":"https://codeload.github.com/kcmvp/gob/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250229305,"owners_count":21396091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","git-hook","git-hooks","multiple-versions","onion-architecture","scaffold"],"created_at":"2024-07-30T20:01:02.256Z","updated_at":"2025-04-22T11:23:36.127Z","avatar_url":"https://github.com/kcmvp.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\nGolang Project Boot\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003ca href=\"https://github.com/kcmvp/gob/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/kcmvp/gob\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/kcmvp/gob\"\u003e\n    \u003cimg src=\"https://goreportcard.com/badge/github.com/kcmvp/gob\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pkg.go.dev/github.com/kcmvp/gob\"\u003e\n    \u003cimg src=\"https://pkg.go.dev/badge/github.com/kcmvp/gob.svg\" alt=\"Go Reference\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/kcmvp/gob/blob/main/.github/workflows/workflow.yml\" rel=\"nofollow\"\u003e\n     \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/kcmvp/gob/workflow.yml?branch=main\" alt=\"Build\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://app.codecov.io/gh/kcmvp/gob\" ref=\"nofollow\"\u003e\n    \u003cimg src =\"https://img.shields.io/codecov/c/github/kcmvp/gob\" alt=\"coverage\"/\u003e\n  \u003c/a\u003e\n\n\u003c/p\u003e\n\n\u003cspan id=\"nav-1\"\u003e\u003c/span\u003e\n\n\u003cspan id=\"nav-2\"\u003e\u003c/span\u003e\n\n## Introduction\n\nAlthough the Golang programming ecosystem is becoming more and more mature,\nthese tools and frameworks exist independently to solve specific problems.\nWhenever a new Golang project is started, it requires a series of initialization;\nWhat’s worse is that whenever your switch the development environment, same process have to be repeated!\nThis project is built to solve this problem by providing a tool named *gbc**, which is similar to [Maven](https://maven.apache.org/)\nor [Gradle](https://gradle.com/) in the **Java** ecosystem together with a framework(glue) similar to [SpringBoot](https://spring.io/projects/spring-boot). Please refer [documents](#commands) for details\n\n\u003cspan id=\"nav-3\"\u003e\u003c/span\u003e\n\n## Features\n\n1. Everything is a plugin, you can use any tool you like as a plugin to customize your build process!\n2. Model driver SQL database DAO(data access object).\n3. IoC Container support via [samber/do](https://github.com/samber/do).\n4. Code generation for most popular frameworks scaffolding.\n5. Environment sensitive profile. **application.yml** for no-test environment and **application-test.yml** for test environment\n6. Friendly help messages\n7. More ....\n\n## What's a gob based project looks like?\nJust like[SpringBoot](https://spring.io/projects/spring-boot), the most important part of a gob project is the **configurations** which define your project.\nThere are **two** main configurations\n1. **gob.yaml** : it acts as the same as **settings.gradle.kts**( [Gradle](https://gradle.com/)) or **pom.xml**([Maven](https://maven.apache.org/)), you can define any thrid party tool as a plugin in this file.\n2. **application.yaml**: it acts as the same **application.yaml** of [SpringBoot](https://spring.io/projects/spring-boot)\n\n\n## Quick Start\n1. Install `gbc` with below command\n```shell\n    go install github.com/kcmvp/gob/cmd/gbc@latest\n```\n2. Initialize project with below command(in the project home directory)\n```shell\n  gbc init\n```\n\n| Git Hooks                                                                                        | Dependency Tree                                                                                      |\n|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| \u003cimg src=\"https://github.com/kcmvp/gob/blob/main/docs/commit_hook.gif\" height=\"245\" width=\"400\"\u003e | \u003cimg src=\"https://github.com/kcmvp/gob/blob/main/docs/dependency_tree.png\" height=\"245\" width=\"300\"\u003e |\n\n\n\n## How gbc works\n`gbc` takes everything defined in the `gob.yaml` as plugin.\n```mermaid\nflowchart TD\n        gbc --\u003e gob.yaml \n        gob.yaml --\u003e plugin1\n        gob.yaml --\u003e plugin2\n        gob.yaml --\u003e plugin3\n```\nYou just need to tell `gbc` 3W(where,when and what)\n1. **Where** : where to download the tool\n2. **When** : when to execute to command\n2. **What** : what to do with the tool\n\n\n## Commands \n\nBuild Commands\n- [gbc init](#gbc-init)\n- [gbc build](#gbc-build)\n- [gbc clean](#gbc-clean)\n- [gbc test](#gbc-test)\n- [gbc lint](#gbc-lint)\n- [gbc deps](#gbc-deps)\n\nPlugin Commands\n- [gbc plugin install](#gbc-plugin-install)\n- [gbc plugin list](#gbc-plugin-list)\n \nSetup Commands\n- [gbc setup version](#gbc-setup-version)\n\n### gbc init\n```shell\ngbc init\n```\nInitialize gbc for the project, it will do following initializations \n1. generate file `gob.yaml`\n2. generate file `.golangci.yaml`, which is the configuration for [golangci-lint](https://github.com/golangci/golangci-lint)\n3. setup `git hooks`(if project in the source control.)  \n   1. commit-msg \n   2. pre-commit \n   3. pre-push\n\n\u003e This command can be executed at any time. \n\nContent of `gob.yaml`\n\n```yaml\nexec:\n    commit-msg-hook: ^#[0-9]+:\\s*.{10,}$\n    pre-commit-hook:\n        - lint\n        - test\n    pre-push-hook:\n        - test\nplugins:\n    golangci-lint:\n        alias: lint #When : when issue `gbc lint`\n        args: run ./... #What: execute `golangci-lint run ./...`\n        url: github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 #Where: where to download the plugin\n    gotestsum:\n        alias: test\n        args: --format testname -- -coverprofile=target/cover.out ./...\n        url: gotest.tools/gotestsum@v1.11.0\n```\nin most cases you don't need to edit the configuration manually. you can achieve this by [plugin commands](#gbc-plugin-install) \n\n### gbc build\n```shell\ngbc build\n```\nThis command would build all the candidate binaries(main methods in main packages) to the `target` folder.\n1. Final binary name is same as go source file name which contains `main method`\n2. Would fail if there are same name go main source file\n\n### gbc clean\n```shell\ngbc clean\n```\nThis command would clean `target` folder\n\n### gbc test\n```shell\ngbc test\n```\nThis command would run all tests for the project and generate coverage report at `target/cover.html`\n\n### gbc lint\n```shell\ngbc lint\n```\nRun `golangci-lint` against project based on the configuration, a report named `target/lint.log` will be generated if there are any violations\n### gbc deps\n```shell\ngbc deps\n```\nList project dependencies tree and indicate there are updates for a specific dependency\n### gbc plugin install\n```shell\ngbc plugin install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 lint run ./...\n```\nIt is an advanced version of `go install`, which supports multi-version.(eg:`golangci-lint-v1.55.2`, `golangci-lint-v1.55.1`)\n1. Install the versioned tool(just the same as `go install`)\n2. Set up the tool as plugin in `gob.yaml`\n3. You can update adjust the parameters of the plugin by editing  `gob.yaml`\n \n### gob plugin list\n\n```shell\ngob plugin list\n```\nList all the installed plugins\n\n### gob setup version\n```shell\ngob setup version\n```\nThis command will generate file `version.go` in `infra` folder, and project version information\nwill be injected into `buildVersion` when build the project with command `gob build`\n```go\n// buildVersion don't change this\nvar buildVersion string\n```\n\n## FAQ\n\n- [When install a plugin, how to find out the url?](#)\n \n   `gob plugin install` work the same way as `go install`, it take the same url as `go install`.\n \n\n- [How to upgrade a plugin ?](#)\n \n   Just simply edit `gob.yaml` file and update the version you want. \n    ```yaml\n   plugins:\n      golangci-lint:\n      alias: lint\n      args: run ./...\n      url: github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2\n   ```\n`\n\n","funding_links":[],"categories":["Build Automation","构建自动化","Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcmvp%2Fgob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcmvp%2Fgob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcmvp%2Fgob/lists"}