Skip to content

Instantly share code, notes, and snippets.

@itaysk

itaysk/Makefile

Last active Apr 30, 2020
Embed
What would you like to do?
Embed file in Go using go link flag
package main
import (
"encoding/base64"
"fmt"
)
var myfile string
func main() {
contents, _ := base64.StdEncoding.DecodeString(myfile)
fmt.Println(string(contents))
}
b64contents = $(shell base64 -w 0 myfile)
build:
go build -ldflags "-X main.myfile=$(b64contents)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.