{"id":21698637,"url":"https://github.com/theohbrothers/docker-go-tools","last_synced_at":"2026-04-12T16:02:21.366Z","repository":{"id":120016373,"uuid":"215755060","full_name":"theohbrothers/docker-go-tools","owner":"theohbrothers","description":"A dockerized workflow that decouples the go runtime and tools from the developer's OS. 🐳","archived":false,"fork":false,"pushed_at":"2019-10-23T05:06:50.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T02:04:24.814Z","etag":null,"topics":["developer","discardability","disposability","docker","ephemerality","go","golang","repeatability","standardization","statelessness","workflow"],"latest_commit_sha":null,"homepage":"","language":"Makefile","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/theohbrothers.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,"publiccode":null,"codemeta":null}},"created_at":"2019-10-17T09:32:34.000Z","updated_at":"2019-10-30T16:46:14.000Z","dependencies_parsed_at":"2023-06-14T17:45:38.856Z","dependency_job_id":null,"html_url":"https://github.com/theohbrothers/docker-go-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theohbrothers/docker-go-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theohbrothers%2Fdocker-go-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theohbrothers%2Fdocker-go-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theohbrothers%2Fdocker-go-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theohbrothers%2Fdocker-go-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theohbrothers","download_url":"https://codeload.github.com/theohbrothers/docker-go-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theohbrothers%2Fdocker-go-tools/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245303,"owners_count":23436512,"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":["developer","discardability","disposability","docker","ephemerality","go","golang","repeatability","standardization","statelessness","workflow"],"created_at":"2024-11-25T19:35:42.157Z","updated_at":"2025-10-25T14:47:16.797Z","avatar_url":"https://github.com/theohbrothers.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-go-tools\n\nA dockerized workflow that decouples the [go](https://golang.org/doc/install) runtime and tools from the developer's OS.\n\nEnables completely dockerized Go development workflows:\n\n- Bind-mounted `go` runtime files on Host\n- Dockerized `go`\n- Dockerized go debug tools (E.g. `dlv`, `gopls`, `bingo`)\n- Standalone `\u003cany go tool you like\u003e`\n\nWith this, a developer machine becomes ephemeral, containing no development state. Also, a developer only needs to change one variable, to switch to a different `go` runtime version.\n\n## How to\n\n1. Install [`bindfs-1.13.10`](https://bindfs.org/) or higher. Required for Step 2.\n\n2. Start a `go` daemon container, `bindfs`-mounting the go runtime files onto the host. Requires `sudo` privilege.\n\n    ```sh\n    make start-go-daemon\n    ```\n\n3. Build go and go tool wrappers and their docker images\n\n    ```sh\n    make\n    ```\n\n    E.g. A docker image named `gopls` is built. A wrapper `gopls` is generated in `./bin`\n\n4. Add this repo's `./bin` to `$PATH`.\n\n    `go` wrapper is now available\n\n    ```sh\n    $ which go\n    /path/to/docker-go-tools/bin/go\n    $ go\n    ```\n\n    Dockerized go tool wrappers should be used in the scope of a repo\n\n    ```sh\n    $ which dlv\n    /path/to/docker-go-tools/bin/dlv\n    # Ensure we are in the scope of a git repo\n    $ cd /path/to/your/repo\n    $ dlv\n    ```\n\n5. Get standalone (non-dockerized) go tools\n\n    ```sh\n    # Ensure we are not in the scope of a git repo\n    cd ~\n    $ go get github.com/golangbot/hello\n    $ which hello\n    /home/user/go/bin/hello\n    $ hello\n    Hello World\n    ```\n\n    You are now ready to start developing. `go`, go tool wrappers (`dlv`, `gopls`, `bingo` etc), and standalone go tools will work as intended. All without dependency on the Host system.\n\n## Build more dockerized go tool wrappers\n\nLet's build a dockerized `golint`\n\n1. In `Makefile`:\n\n    - Add `golint` to `ALL_BINS` in `Makefile`. E.g. `dlv gopls bingo golint`\n    - Add `golint` package as a variable. E.g. `golint_PACKAGE := golang.org/x/lint/golint`\n\n2. Run `make`.\n\n## Remove the dockerized go tools wrappers\n\n`make all-remove`\n\n## How it works\n\n### 1. Go runtime files\n\nWe create daemon `go` container, and `bindfs` its `GOROOT` (`/usr/local/go`) onto the Host at the same path (`/usr/local/go`). Read more [here](https://github.com/moby/moby/issues/26872#issuecomment-249416877).\n\nThis allows the user to access Go runtime / native files as though it were installed on the Host.\nMore importantly, it allows a local debugger (e.g. `dlv`) or go-to-definition tool (e.g. `gopls` or `godef`) to open the necessary Go native files.\n\n### 2. `go` wrapper\n\nWhen called outside of the folder of a git repository, the `GOPATH` is `$HOME/go`, and `GOCACHE` is `$HOME/.cache/go-build`, as defined in Makefile.\n\nWhen called within the folder of a git repository, the `GOPATH` and `GOCACHE` are `/path/to/repo/.go` and `/path/to/repo/.go/.cache/go-build`, as defined in the Makefile. Your workspace environment *may* want to define these variables to override the wrapper's defaults just to be sure they are set correctly.\n\n### 3. Go tools wrappers\n\nThese must be used in the folder of a git repository. The `GOPATH` and `GOCACHE` are `/path/to/repo/.go` and `/path/to/repo/.go/.cache/go-build`.\n\n### 4. Standalone Go tools\n\nThe binaries will still reside in `$GOPATH/bin` as defined in Makefile.\n\n## FAQ\n\n### Q: I see no files in `/usr/bin/go`?\n\nYou need to have at least `bindfs-1.13.10` or higher. More information [here](https://github.com/mpartel/bindfs/issues/66#issuecomment-428323548)\n\n### Q: `bindfs` of the Go daemon container's `GOROOT` does not work on Docker for Windows or Docker for Mac?\n\nYes. The `bindfs` approach only works on Linux at the moment. This is because Docker for Windows/Mac both use a separate VM for the container space, and the host is unable to see the container's files. Read more details [here](https://github.com/moby/moby/issues/26872#issuecomment-249416877)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheohbrothers%2Fdocker-go-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheohbrothers%2Fdocker-go-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheohbrothers%2Fdocker-go-tools/lists"}