V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
funky

go build windows 不带资源目录

  •  
  •   funky · Apr 28, 2020 · 2450 views
    This topic created in 2189 days ago, the information mentioned may be changed or developed.
    求解
    5 replies    2020-05-06 15:09:43 +08:00
    funky
        1
    funky  
    OP
       Apr 28, 2020
    就是打出来的 exe 可以带资源目录
    killerirving
        2
    killerirving  
       Apr 28, 2020
    资源目录本来就不会打包进去,这种需求看看 go-bindata 类似的项目
    soseek
        3
    soseek  
       Apr 28, 2020 via Android
    sunshinev
        4
    sunshinev  
       May 6, 2020
    按照 @killerirving 说的,使用 go-bindata 来做吧,非常好用,https://github.com/sunshinev/go-sword 我的这个项目就是使用了 go-bindata 来进行了静态资源打包
    sunshinev
        5
    sunshinev  
       May 6, 2020
    go 是编译行语言,在 build 的时候,只会将相关用到的资源打包。但是很多资源是启动 http 服务之后,通过请求来解析的本地静态资源。比如 css 、js 、html 模板等,这些会根据路由来匹配不同的文件。所以需要进行 go-bindata 打包成 go 文件
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6057 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 02:14 · PVG 10:14 · LAX 19:14 · JFK 22:14
    ♥ Do have faith in what you're doing.