当在编译打包文件时,有时候html文件需要编译进二进制 , 可以使用这个包

github.com/gobuffalo/packr

 

当使用了go.mod的话 , 直接在代码中引入使用就行 , 运行或者编译时会自动把依赖下载下来

box := packr.NewBox("../static")

content,err:=box.FindString("html/login.html")

这样读取到的字符串 , 再使用template包就可以了 , 编译后html也会被编译进去

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-12-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-08
  • 2021-12-13
  • 2022-01-25
相关资源
相似解决方案