{"id":13413726,"url":"https://github.com/wlbr/mule","last_synced_at":"2026-01-23T11:58:54.753Z","repository":{"id":57518685,"uuid":"234530291","full_name":"wlbr/mule","owner":"wlbr","description":"mule is a tool to be used with 'go generate' to embed external resources files into Go code.","archived":false,"fork":false,"pushed_at":"2021-08-16T20:23:29.000Z","size":2845,"stargazers_count":15,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-15T12:40:11.620Z","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/wlbr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["wlbr"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-01-17T10:56:00.000Z","updated_at":"2024-04-05T18:53:33.000Z","dependencies_parsed_at":"2022-09-26T18:01:46.479Z","dependency_job_id":null,"html_url":"https://github.com/wlbr/mule","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wlbr/mule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlbr%2Fmule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlbr%2Fmule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlbr%2Fmule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlbr%2Fmule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wlbr","download_url":"https://codeload.github.com/wlbr/mule/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wlbr%2Fmule/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28690611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T11:01:27.039Z","status":"ssl_error","status_checked_at":"2026-01-23T11:00:26.909Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-30T20:01:47.520Z","updated_at":"2026-01-23T11:58:54.731Z","avatar_url":"https://github.com/wlbr.png","language":"Go","readme":"# mule\nA tool to be used with 'go generate' to embed external resources into Go code to create\nsingle file exceutables without any dependencies.\n\n\n## Scenario\n\nAn often used scenario in developing go applications is to embed external resources\nto be able to create only one binary without any dependencies.\nThere are a number of existing packages solving this problem, like [bindata](https://github.com/a-urth/go-bindata),\n[packr](https://github.com/gobuffalo/packr/tree/master/v2) or [packger](https://github.com/markbates/pkger)\nand if you are looking for fancy features and unicorns you should probably better go there.\nUsually they are creating a kind of virtual file system. Usually this is really a lot more than I need for my\nsimple usecase of including one or two files into a small cli program.\n\nThis package 'mule' (the kinda donkey carrying huge loads) takes a _much simpler_ approach.\nIt just generates a single .go file for each resource you want to embed, including the\nencoded resource wrapped in a function to access it.\n\nIt is intended to be run by go generate, though that is not required.\n\n\n## Installation\n   `go get github.com/wlbr/mule`\n\n\n## Usage\n\nSimply add a line\n\n   `//go:generate mule mybinary.file`\n\nto one of your source file for each resource you want to embed. Every time you run a 'go generate' in the\ncorresponding folder, the file 'mybinary.go' will be created. It contains a\nfunction 'mybinaryResource' returning the resource as a []byte.\n\nSee [mulex.go](https://github.com/wlbr/mule/blob/master/example/mulex.go) for a very, very simple example.\n\nYou may use 'mule mybinary.file' directly on the command line.\n\n\n## Switches\n\nUsage of mule: `mule [switches] resourcefilename`\u003cbr\u003e\n   -e\u003cbr\u003e\n      export the generated, the resource returning function. Default (false) means\n      the function will not be exported.\n\n   -f\u003cbr\u003e\n      no formatting of the generated source. Default false means source will be\n      formatted with gofmt.\n\n   -n string\u003cbr\u003e\n    \t name of generated, the resource returning function. Its name will have\n      'Resource' attached. Will be set to $(basename -s .ext outputfile) if empty\n      (default). Take care of \"-\" within the name, especially when the name is\n      calculated from the resources file name.  A '-' would create an invalid go\n      function name\n\n   -o string\u003cbr\u003e\n    \t name of output file. Defaults to name of resource file excluding\n      extension + '.go'.\n\n   -p string\u003cbr\u003e\n  \t name of package to be used in generated code (default \"main\").\n\n   -t string\u003cbr\u003e\n    \t name of alternate code generation template file. If empty (default), then\n      the embedded template will be used. Template variables supplied are:\n      .Name, .Package, .Content\n\n\n## Code\n* Documentation: https://godoc.org/github.com/wlbr/mule\n* Lint: http://go-lint.appspot.com/github.com/wlbr/mule\n* Continous Integration: [![Travis Status](https://api.travis-ci.com/wlbr/mule.svg?branch=master)](https://travis-ci.com/wlbr/mule)\n* Test Coverage: [![Coverage Status](https://coveralls.io/repos/github/wlbr/mule/badge.svg?branch=master)](https://coveralls.io/github/wlbr/mule?branch=master)\n* Metrics: [![GoReportCard](https://goreportcard.com/badge/github.com/wlbr/mule)](https://goreportcard.com/report/github.com/wlbr/mule)\n","funding_links":["https://github.com/sponsors/wlbr"],"categories":["Resource Embedding","资源嵌入","嵌入的资源","Relational Databases"],"sub_categories":["HTTP Clients","查询语","HTTP客户端"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlbr%2Fmule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwlbr%2Fmule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwlbr%2Fmule/lists"}