{"id":22369897,"url":"https://github.com/firmanmm/go-mod-private","last_synced_at":"2025-03-26T16:24:12.078Z","repository":{"id":57546839,"uuid":"204105259","full_name":"firmanmm/go-mod-private","owner":"firmanmm","description":"A simple helper toolkit to help development with Private Git Server","archived":false,"fork":false,"pushed_at":"2021-01-24T08:07:02.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T19:40:11.457Z","etag":null,"topics":["go","golang","golang-cli","gomod","package-manager"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firmanmm.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}},"created_at":"2019-08-24T03:52:59.000Z","updated_at":"2021-01-24T08:02:10.000Z","dependencies_parsed_at":"2022-09-05T10:51:29.227Z","dependency_job_id":null,"html_url":"https://github.com/firmanmm/go-mod-private","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firmanmm%2Fgo-mod-private","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firmanmm%2Fgo-mod-private/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firmanmm%2Fgo-mod-private/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firmanmm%2Fgo-mod-private/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firmanmm","download_url":"https://codeload.github.com/firmanmm/go-mod-private/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245690250,"owners_count":20656556,"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":["go","golang","golang-cli","gomod","package-manager"],"created_at":"2024-12-04T19:29:39.798Z","updated_at":"2025-03-26T16:24:12.058Z","avatar_url":"https://github.com/firmanmm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Mod Private\nA simple helper toolkit to help development with Private Git Server using Golang Module. It allows you to use Git Private Server for your vendor. You can also use `gomp get` just as `go get`. \n\n*Note* : Currently `gomp` didn't support `./...` operation.\n\n## Installation\nBefore installing `gomp`, you have to make sure that you have `git` installed on your system.\nTo install `gomp` command line interface, simply use syntax below :\n```\ngo get github.com/firmanmm/go-mod-private/cmd/gomp\n```\n\n## Usage\nIf you don't know what this tool does, simply add `-h` when using `gomp` cli. \n\nExample : \n```\n$ gomp -h\nNAME:\n   GoModPrivate - Go Module for Private Git Server Repository\n\nUSAGE:\n   gomp.exe [global options] command [command options] [arguments...]\n\nVERSION:\n   0.0.0\n\nDESCRIPTION:\n   Allow you to use Git Private Server as your source dependency while using Go Module\n\nAUTHOR:\n   Firman \"Rendoru\" Maulana \n\nCOMMANDS:\n   get             Perform Go Get operation, will switch to git clone and git pull if a matching SSH Credential has been registered\n   add_credential  Add credential to be used for [get] command\n   sync            Synchronize vendor.gomp and go.mod to mod.gomp\n   help, h         Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --gomp value   Read from given gomp file (default: \"mod.gomp\")\n   --help, -h     show help\n   --version, -v  print the version\n```\n### Getting Package\nIf you want to use `gomp` just like using `go get` you just need to replace `go get` with `gomp get`.\nSyntax : \n```\n$ gomp get [arguments...]\n```\nExample :\n```\n$ gomp get github.com/firmanmm/suberror\n```\n`gomp` will try to scan your `mod.gomp` file to determine any `SshCredential` that match your requested package. `gomp` will match with the longest matching `SshCredential` if there are multiple credentials that can be used by your request. Upon match, `gomp` will perform `git clone` internally to get your desired package. If there are **no credentials** that match your request, `gomp` will use `go get` to get your request.\n\n#### How it works\n- `gomp` try to find any matching credential\n    - If nothing match, `gomp` will use `go get`\n- `gomp` will perform `git clone` using your `SshCredentials` instead `go get` \n- `gomp` will add the cloned repository to `vendor.gomp`\n- `gomp` will then update your `go.mod` to use files from `vendor.gomp`. It will only update your `gomp get`'ed repository\n- `gomp` will keep track of your private repository in `mod.gomp`\n\n### Adding Credentials\n`gomp` support adding credentials to `mod.gomp` via CLI. This way, you don't have to edit your `mod.gomp` manually.\nSyntax :\n```\n$ gomp add_credential --host=[Required] --user=[Required] --base=[Optional] --pattern=[Optional]\n```\n- `--host` : Your target host. **Required**\n- `--user` : Your target user. **Required**\n- `--base` : Base path for searching for package.\n- `--pattern` : Will be used to match your requested package with this credential.\nExample : \n```\n$ gomp add_credential --host=rendoru.com --user=someone --base=/home/someone --pattern=\"rendoru.com(.*)\"\n```\n### Synchronizing\n`gomp` can automatically synchronize `vendor.gomp` and `go.mod` with the `mod.gomp`. This way you don't have to manually `get` them one by one.\nSyntax : \n``` \n$ gomp sync\n```\n\n## Example\nBelow are the example of Go Mod Private's output\n\n### Example mod.go\n```\nmodule github.com/firmanmm/go-mod-private\n\ngo 1.12\n\nrequire (\n\tgithub.com/go-ini/ini v1.46.0 // indirect\n\tgithub.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect\n\tgithub.com/urfave/cli v1.21.0\n\tgopkg.in/ini.v1 v1.46.0 // indirect\n)\n\n//GO_MOD_PRIVATE_START\n//This is an auto generated section made by Go Mod Private\n//For more information visit https://github.com/firmanmm/go-mod-private\n//Please add vendor.gomp to your .gitignore\n\nreplace (\n\trendoru.com/module/sync-mq =\u003e ./vendor.gomp/rendoru.com/module/sync-mq\n\trendoru.com/tool/concurrent =\u003e ./vendor.gomp/rendoru.com/tool/concurrent\n\n)\n\n//GO_MOD_PRIVATE_END\n```\n\n#### Example mod.gomp\n```\n{\n    \"SshCredentials\": [\n        {\n            \"Matcher\": \"rendoru.com(.*)\",\n            \"Host\": \"rendoru.com\",\n            \"Username\": \"someone\",\n            \"BasePath\": \"/home/someone\"\n        }\n    ],\n    \"PrivateRepositories\": [\n        \"rendoru.com/module/sync-mq\",\n        \"rendoru.com/tool/concurrent\"\n    ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirmanmm%2Fgo-mod-private","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirmanmm%2Fgo-mod-private","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirmanmm%2Fgo-mod-private/lists"}