https://github.com/tranphuquy19/go-embed
https://github.com/tranphuquy19/go-embed
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tranphuquy19/go-embed
- Owner: tranphuquy19
- Created: 2022-11-11T09:55:30.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-11T15:17:56.000Z (over 2 years ago)
- Last Synced: 2025-01-13T02:14:05.449Z (4 months ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Go embed
Embed executable file and execute it in memory.
**Example**: https://replit.com/@tranphuquy19/go-embed#readme.md
## Usage
1. Build hello-world binary file to test.
```bash
gcc -o hello-world hello-world.cpp
```2. Embed hello-world binary file to go file. And build it.
```bash
export CGO_ENABLED=0 # run this command only once
go build .
./go-embed
```3. Change executable file name to test.
- Update go directive `//go:embed hello-world` to your executable file name (at line 10 in main.go), and build it again.
4. Multi platform support
- Check supported platform list by `go tool dist list`. Copy them to `platforms.txt` file.
- Then run```bash
chmod +x build.sh # run this command only once
./build.sh
```- Check `build` folder, you will see executable file for each platform.