forked from fyne-io/fyne-cross
/
main.go
33 lines (27 loc) · 838 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// This file embeds resources like Dockerfiles to be used in fyne-cross
// TODO: move to go:embed once the go min version required by fyne-cross will be 1.16
package main
import (
"fmt"
"io/ioutil"
"os"
"text/template"
)
func main() {
b, err := ioutil.ReadFile("docker/darwin/Dockerfile")
if err != nil {
fmt.Printf("could not read darwin Dockerfile, please run from the project root: %s", err)
os.Exit(1)
}
f, err := os.Create("internal/resource/darwin_dockerfile.go")
if err != nil {
fmt.Printf("could not write embedded darwin Dockerfile, please run from the project root: %s", err)
os.Exit(1)
}
t := template.Must(template.New("dockerfile").Parse(tpl))
t.Execute(f, fmt.Sprintf("`%s`", b))
}
var tpl = `// auto-generated by cmd/internal/main.go DO NOT EDIT.
package resource
const DockerfileDarwin = {{.}}
`