2017-03-20 19:15 阅读 73


I'm just getting started with Go, and also thought I'd learn Sublime Text while I was at it.

I've installed the official Go Build package for Sublime and got everything building nicely. But my little project relies on binary resources, so I'm using go-bindata to build my files directly into my executable.

What I need help with is the fact I don't know how to add the command line call to go-bindata to the build processes provided by Go Build. Ideally I'd like to simply run the command before the build process starts.

I'm working on Windows 10, if that's important info.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    doukefu1361 doukefu1361 2017-03-20 19:56

    Usually this is done with go generate. Although the Sublime3 bundle does not support this.

    In one of your files add something like this into as the top comment:

    //go:generate go-bindata data/

    Now you can bundle and bundle your project with go generate and then go build.

    This works on all platforms that are supported by Go.

    If really need a one command does everything thing: Use a Makefile or a batch script and use that as your build command in Sublime.

    点赞 评论 复制链接分享