const(
EVE_ICON_SOURCE = "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAY...."
ICON_PATH = "/tmp/eve.png"
)
// Check and export icon file from source
func iconExport() {
var _, err = os.Stat(ICON_PATH)
// Check exist icon file
if os.IsNotExist(err) {
// iconfile exist? Create
file, err := os.Create(ICON_PATH)
checkError(err)
defer file.Close()
// Open new iconfile
iconFile, err := os.OpenFile(ICON_PATH, os.O_RDWR, 0644)
checkError(err)
defer iconFile.Close()
// Decode Base64 string in bytecode
iconSource, err := base64.StdEncoding.DecodeString(EVE_ICON_SOURCE)
checkError(err)
// Write bew icon
_, err = iconFile.Write(iconSource)
checkError(err)
iconFile.Close()
}
}
go build -ldflags "-X main.buildTime=`date +%Y-%m-%d:%H:%M:%S` -X main.gitHash=`git rev-parse --short HEAD`"