{"id":17063492,"url":"https://github.com/akavel/embd-go","last_synced_at":"2025-04-12T18:44:28.098Z","repository":{"id":25777875,"uuid":"29216243","full_name":"akavel/embd-go","owner":"akavel","description":"embd-go is an embeddable command-line tool for embedding data files in Go source code, specially crafted for easy use with `go generate`.","archived":false,"fork":false,"pushed_at":"2016-01-13T22:03:52.000Z","size":15,"stargazers_count":26,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T06:35:55.729Z","etag":null,"topics":["binary","embed","go","go-generate","link","mit","resources"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akavel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-13T23:08:57.000Z","updated_at":"2024-09-16T13:30:45.000Z","dependencies_parsed_at":"2022-08-24T14:14:22.490Z","dependency_job_id":null,"html_url":"https://github.com/akavel/embd-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akavel%2Fembd-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akavel%2Fembd-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akavel%2Fembd-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akavel%2Fembd-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akavel","download_url":"https://codeload.github.com/akavel/embd-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617199,"owners_count":21134190,"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":["binary","embed","go","go-generate","link","mit","resources"],"created_at":"2024-10-14T10:52:11.431Z","updated_at":"2025-04-12T18:44:28.071Z","avatar_url":"https://github.com/akavel.png","language":"Go","readme":"## About embd-go tool\n\n[![License: MIT.](https://img.shields.io/badge/license-MIT-orange.svg)](http://choosealicense.com/licenses/mit/)\n\nembd-go is an embeddable command-line tool for embedding data files in Go source code, ***specially crafted for easy use with [`go generate`](http://blog.golang.org/generate)***.\n\n## Easy use with [`go generate`](http://blog.golang.org/generate)\n\nThe embd.go is a single, self-contained, MIT-licensed, go-runnable file, so you can ***copy it verbatim*** into your own project's repository, and keep it there forever:\n\n             go get -d -u github.com/akavel/embd-go\n    Windows: copy %GOPATH%\\src\\github.com\\akavel\\embd-go\\embd.go tools\\embd.go\n    Linux:   cp $GOPATH/src/github.com/akavel/embd-go/embd.go tools/embd.go\n    \nand then call from e.g. [`go generate`](http://blog.golang.org/generate) via `go run`, by putting a line like shown below in one of your Go source files:\n\n    //go:generate go run tools/embd.go -o embd/data.go -p embd MY_DATA/HELLO.DAT MY_DIRECTORY\n\n\n## Usage\n\n```\nUSAGE: go run embd.go [FLAGS] PATH...\n  -o=\"embd/data.go\": Path to generated file.\n  -p=\"embd\": Package that the generated file should be in.\n```\n\nNote: directories that are used as a `PATH` will be added non-recursively (only immediate children)\n\n## Example\n\n```\nC:\u003e go get github.com/akavel/embd-go\nC:\u003e echo Hello\u003e hello.txt\nC:\u003e embd-go.exe -o hello.go -p main hello.txt\nC:\u003e type hello.go\n// DO NOT EDIT BY HAND\n//\n// Generated with:\n//\n//      embd-go \"-o\" \"hello.go\" \"-p\" \"main\" \"hello.txt\"\n\npackage main\n\n// File_hello_txt contains contents of \"hello.txt\" file.\nvar File_hello_txt = []byte(\"Hello\\r\\n\")\n```\n\nAlso, you could use directories as `PATH`. For example:\n\n```bash\n$ mkdir -p configs\n$ echo 'config1' \u003e configs/1.conf\n$ echo 'config2' \u003e configs/2.conf\n$ ./embd-go -p \"configs\" configs\n$ cat embd/data.go\n// DO NOT EDIT BY HAND\n//\n// Generated with:\n//\n//\tembd-go \"-p\" \"configs\" \"configs\"\n\npackage configs\n\nvar Dir_configs = struct {\n\t// File_1_conf contains contents of \"configs/1.conf\" file.\n\tFile_1_conf []byte\n\t// File_2_conf contains contents of \"configs/2.conf\" file.\n\tFile_2_conf []byte\n}{\n\t[]byte(\"config1\\n\"),\n\t[]byte(\"config2\\n\"),\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakavel%2Fembd-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakavel%2Fembd-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakavel%2Fembd-go/lists"}