An open API service indexing awesome lists of open source software.

https://github.com/koddr/example-embed-static-files-go

The easiest way to embed static files into a binary file in your Golang app (no external dependencies).
https://github.com/koddr/example-embed-static-files-go

tutorial-code tutorial-exercises

Last synced: 2 months ago
JSON representation

The easiest way to embed static files into a binary file in your Golang app (no external dependencies).

Awesome Lists containing this project

README

          

# Example for embed static files into a binary

This is full project structure example of article [**The easiest way to embed static files into a binary file in your Golang app (no external dependencies)**](https://dev.to/koddr/the-easiest-way-to-embed-static-files-into-a-binary-file-in-your-golang-app-no-external-dependencies-43pc).

Published on [Dev.to](https://dev.to/koddr/the-easiest-way-to-embed-static-files-into-a-binary-file-in-your-golang-app-no-external-dependencies-43pc) @ 31 Jan 2020.

## Requirements

- Go `1.11+`
- Go Modules

## Usage

- Clone this repository and go to folder:

```console
git clone https://github.com/koddr/example-embed-static-files-go.git
cd example-embed-static-files-go
```

- Install `gosec` (I recommend):

```console
go get github.com/securego/gosec/cmd/gosec
```

- Try to build binary:

```console
make build
```

- No errors? Let's run:

```console
make run
```

![result](https://dev-to-uploads.s3.amazonaws.com/i/xrrjdorf4vgg081hbnfb.png)

- That's all!

## Author

- [Vic Shóstak](https://github.com/koddr) (aka Koddr).

## Article assistance

If you want to say «thank you»:

1. Twit about article [on your Twitter](https://twitter.com/intent/tweet?text=The%20easiest%20way%20to%20embed%20static%20files%20into%20a%20binary%20file%20in%20your%20Golang%20app%20%28no%20external%20dependencies%29%20https%3A%2F%2Fdev.to%2Fkoddr%2Fthe-easiest-way-to-embed-static-files-into-a-binary-file-in-your-golang-app-no-external-dependencies-43pc).
2. Add a GitHub Star and make Fork to this repository.
3. Donate some money to project author via PayPal: [@paypal.me/koddr](https://paypal.me/koddr?locale.x=en_EN) or [LiberaPay](https://liberapay.com/koddr/donate).
4. Join DigitalOcean at our [referral link](https://m.do.co/c/b41859fa9b6e) (your profit is **\$100** and we get \$25).

Thanks for your support! 😘

## License

MIT