Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/internal/fileutils/assets.go b/internal/fileutils/assets.go 2index 83eacd9..0b80e51 100644 3--- a/internal/fileutils/assets.go 4+++ b/internal/fileutils/assets.go 5@@ -1,28 +1,7 @@ 6 //go:generate rice embed 7 package fileutils 8 9-import ( 10- "os" 11- "sync" 12- 13- rice "github.com/GeertJohan/go.rice" 14- "github.com/go-flutter-desktop/hover/internal/log" 15-) 16- 17-var ( 18- assetsBox *rice.Box 19- assetsBoxOnce sync.Once 20-) 21- 22 // AssetsBox hover's assets box 23-func AssetsBox() *rice.Box { 24- assetsBoxOnce.Do(func() { 25- var err error 26- assetsBox, err = rice.FindBox("../../assets") 27- if err != nil { 28- log.Errorf("Failed to find hover assets: %v", err) 29- os.Exit(1) 30- } 31- }) 32- return assetsBox 33+func AssetsBox() string { 34+ return "@assetsFolder@" 35 } 36diff --git a/internal/fileutils/file.go b/internal/fileutils/file.go 37index cb75563..3822e80 100644 38--- a/internal/fileutils/file.go 39+++ b/internal/fileutils/file.go 40@@ -11,8 +11,6 @@ import ( 41 "strings" 42 "text/template" 43 44- rice "github.com/GeertJohan/go.rice" 45- 46 "github.com/go-flutter-desktop/hover/internal/log" 47 ) 48 49@@ -215,24 +213,24 @@ func ExecuteTemplateFromFile(boxed, to string, templateData interface{}) { 50 } 51 52 // ExecuteTemplateFromAssetsBox create file from a template asset 53-func ExecuteTemplateFromAssetsBox(boxed, to string, assetsBox *rice.Box, templateData interface{}) { 54- templateString, err := assetsBox.String(boxed) 55+func ExecuteTemplateFromAssetsBox(boxed, to string, assetsBox string, templateData interface{}) { 56+ templateString, err := ioutil.ReadFile(assetsBox + "/" + boxed) 57 if err != nil { 58 log.Errorf("Failed to find template file: %v\n", err) 59 os.Exit(1) 60 } 61- executeTemplateFromString(templateString, to, templateData) 62+ executeTemplateFromString(string(templateString), to, templateData) 63 } 64 65 // CopyAsset copies a file from asset 66-func CopyAsset(boxed, to string, assetsBox *rice.Box) { 67+func CopyAsset(boxed string, to string, assetsBox string) { 68 file, err := os.Create(to) 69 if err != nil { 70 log.Errorf("Failed to create %s: %v", to, err) 71 os.Exit(1) 72 } 73 defer file.Close() 74- boxedFile, err := assetsBox.Open(boxed) 75+ boxedFile, err := os.OpenFile(assetsBox + "/" + boxed, os.O_RDONLY, 0666) 76 if err != nil { 77 log.Errorf("Failed to find boxed file %s: %v", boxed, err) 78 os.Exit(1)