{"id":18465546,"url":"https://github.com/numtide/build-go-cache","last_synced_at":"2025-04-08T08:31:56.564Z","repository":{"id":204859998,"uuid":"710323401","full_name":"numtide/build-go-cache","owner":"numtide","description":"buildGoCache speeds up nix's buildGoModule by pre-compiling imported go modules","archived":false,"fork":false,"pushed_at":"2024-10-02T14:57:38.000Z","size":24,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T23:55:51.092Z","etag":null,"topics":["buildbot-numtide"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numtide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-10-26T13:19:50.000Z","updated_at":"2025-03-29T15:19:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"d47a306e-d8ae-4249-b66b-0fb9a50a4fdd","html_url":"https://github.com/numtide/build-go-cache","commit_stats":null,"previous_names":["numtide/build-go-cache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbuild-go-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbuild-go-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbuild-go-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numtide%2Fbuild-go-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numtide","download_url":"https://codeload.github.com/numtide/build-go-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804596,"owners_count":20999018,"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":["buildbot-numtide"],"created_at":"2024-11-06T09:13:31.099Z","updated_at":"2025-04-08T08:31:56.313Z","avatar_url":"https://github.com/numtide.png","language":"Nix","readme":"# buildGoCache\n\nbuildGoCache speeds up nix's buildGoModule by pre-compiling imported go modules\n\n## Potential speed-up\n\nFor telegraf we measured the following build times with and without the buildGoCache.\n\nBuild machine: AMD Ryzen 9 7950X3D 16-Core Processor, 128G DDR4 RAM, zfs raid0\n\nwithout cache:\n\n```\ntime nix build .#example-no-cache -L\n0.28s user 0.20s system 0% cpu 59.539 total\ntime nix build .#example-proxy-vendor-no-cachA\n0.30s user 0.20s system 0% cpu 1:14.01 total\n```\n\nwith cache:\n\n```\ntime nix build .#example -L\n0.23s user 0.18s system 1% cpu 25.872 total\ntime nix build .#example-proxy-vendor -L\n0.03s user 0.04s system 0% cpu 30.501 total\n```\n\nSpeedup: 2.3x..~2.4x\n\n## Usage\n\nFirst we generate a list of all imported packages:\n\n```\nnix run .#get-external-imports -- ./. imported-packages\n```\n\nThan we modify our `buildGoModule` to use your go build cache:\n\n```nix\nlet\n  vendorHash = \"sha256-aMO7nH68E1S5G1iWj29McK0VY0frfjNnJ6D6rJ29cqQ=\";\n  proxyVendor = true; # must be in sync for buildGoCache and buildGoModule\n  src = ./.; # replace this with the source directory\n\n  goCache = buildGoCache {\n    importPackagesFile = ./imported-packages;\n    inherit src vendorHash proxyVendor;\n  };\nin\nbuildGoModule {\n  name = \"myproject\";\n\n  buildInputs = [ goCache ];\n\n  inherit src;\n\n  inherit vendorHash proxyVendor;\n}\n```\n\nSee [./examples]() for real-world examples based on telegraf and gomod2nix\n\nOther [real-world example](https://github.com/replit/upm/pull/155)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fbuild-go-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumtide%2Fbuild-go-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumtide%2Fbuild-go-cache/lists"}