{"id":22787373,"url":"https://github.com/aserto-dev/mage-loot","last_synced_at":"2025-04-15T23:39:08.571Z","repository":{"id":38328254,"uuid":"334452339","full_name":"aserto-dev/mage-loot","owner":"aserto-dev","description":"Collection of reusable, useful code for magefiles","archived":false,"fork":false,"pushed_at":"2024-10-31T23:31:29.000Z","size":278,"stargazers_count":22,"open_issues_count":13,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-01T00:22:09.631Z","etag":null,"topics":[],"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/aserto-dev.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":"2021-01-30T16:00:17.000Z","updated_at":"2024-10-31T23:31:33.000Z","dependencies_parsed_at":"2023-11-22T13:45:32.483Z","dependency_job_id":"c66393a2-3f76-4660-bf75-f8d5b4a2968a","html_url":"https://github.com/aserto-dev/mage-loot","commit_stats":{"total_commits":130,"total_committers":13,"mean_commits":10.0,"dds":0.6461538461538461,"last_synced_commit":"db915858448b05767029edb11046dd0610365ef2"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Fmage-loot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Fmage-loot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Fmage-loot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aserto-dev%2Fmage-loot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aserto-dev","download_url":"https://codeload.github.com/aserto-dev/mage-loot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229313609,"owners_count":18053713,"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":[],"created_at":"2024-12-12T00:54:54.185Z","updated_at":"2024-12-12T00:54:54.776Z","avatar_url":"https://github.com/aserto-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mage-loot\n\n[![Built with Mage](https://magefile.org/badge.svg)](https://magefile.org)\n![ci](https://github.com/aserto-dev/mage-loot/workflows/ci/badge.svg?branch=main)\n[![Coverage Status](https://coveralls.io/repos/github/aserto-dev/mage-loot/badge.svg?branch=main\u0026t=4v6ABX\u0026service=github)](https://coveralls.io/github/aserto-dev/mage-loot?branch=main)\n[![Go Report Card](https://goreportcard.com/badge/github.com/aserto-dev/mage-loot)](https://goreportcard.com/report/github.com/aserto-dev/mage-loot)\n[![Go Reference](https://pkg.go.dev/badge/github.com/aserto-dev/mage-loot.svg)](https://pkg.go.dev/github.com/aserto-dev/mage-loot)\n\nCollection of reusable, useful code for magefiles.\n\n\u003e **FAQ:** The `Depfile` used by `mage-loot` is what you probably want as a starting point for your project.\n\nA bit about mage-loot, and what it contains:\n\n- Dependency management using `Depfile`.\n- Helpers for automating the `buf`, `dotnet`, and `protoc` CLIs.\n- Opinionated build functions for `go` and `docker`.\n- Opinionated helper functions for go projects, like linting, testing and code generation.\n\n## Depfile\n\nOne problem that we’ve had to repeatedly solve is making sure the human and robot teams all use the same tools, binaries and libraries when building projects.\nThere are some solutions out there, but they didn’t fit our needs for various reasons (some are too hard to adopt, some don’t have enough features).\n\nWith Depfile, we’re aiming for enough features so that you can reliably build complex projects, but simple enough that you understand how to use it in less than 10 min.\n\nAs a developer, you have to buy into [mage](https://github.com/magefile/mage).\nNext to your `magefile`, you add a `Depfile`. It’s a yaml file with the following structure:\n\n```yaml\n---\ngo:\n  tool:\n    importPath: \"so.me/import/path\"\n    version: \"v1.0.0\"\n\nbin:\n  useful-binary:\n    url: 'https://so.me/url/v{{.Version}}/protoc-{{.Version}}-{{if eq .OS \"darwin\"}}osx{{else}}{{.OS}}{{end}}-x86_64.zip'\n    version: \"1.1.0\"\n    sha:\n      linux-amd64: \"d4246a5136cf9cd1abc851c521a1ad6b8884df4feded8b9cbd5e2a2226d4b357\"\n      darwin-amd64: \"68901eb7ef5b55d7f2df3241ab0b8d97ee5192d3902c59e7adf461adc058e9f1\"\n    zipPaths:\n    - \"bin/the.binary\"\nlib:\n  useful-lib:\n    url: \"https://so.me/url/v{{.Version}}.tgz\"\n    version: \"2.5.0\"\n    sha: \"e8334c270a479f55ad9f264e798680ac536f473d7711593f6eadab3df2d1ddc3\"\n    libPrefix: \"lib-{{.Version}}\"\n    tgzPaths:\n    - \"*/glob/patterns/*.proto\"\n```\n\nYou’ll notice we support 3 types of dependencies:\n- go\n- binaries\n- libraries\n\nFor **go** tools (where you need a go tool but it’s not a dependency of your app), we just use `go` to install the version you specify.\n\nFor **binaries**, we download the file or archive from a location we calculate based on a template and a version, OS and architecture.\nIf you’re downloading an archive, you can specify which file to extract from it. Binaries will live in a `.ext/bin` directory inside your project.\nWe also need you to give us the SHA of the artifact we’re downloading, so we can make sure there’s no trickery!\n\nFor **libraries**, we assume you’re downloading archives, either zip or tgz. You can again use a template for the download URL, but there’s no differentiation on architecture or OS. Libraries live in `.ext/lib`. You can use globbing patterns to select which files to unpack from the archive.\nAgain, we need a SHA to verify integrity.\n\nYou can use the Depfile from [mage-loot](https://github.com/aserto-dev/mage-loot/blob/main/Depfile) itself as an example to get you started.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserto-dev%2Fmage-loot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faserto-dev%2Fmage-loot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faserto-dev%2Fmage-loot/lists"}