将多个图像打包到 GOLANG 二进制文件中

huangapple go评论90阅读模式
英文:

Packing multiple images into a GOLANG binary

问题

GOLANG 高手们:

我知道这可能看起来不合逻辑,但还是请听我说。

我需要将一个二进制文件(在这种情况下是一个 web 服务器)分发给其他工程师进行测试。为了简化操作,因为他们可能不是开发人员,我想知道是否有一种自动化的方式可以将图像打包到 GOLANG 二进制文件中?我以前在静态 HTML 页面上做过这样的操作,效果很好。

显然,第一次运行时我可以解压到文件系统中,但为了保持整洁,我想知道是否有人有任何想法,如何将它们塞进二进制文件中。

有什么想法吗?

英文:

GOLANG gurus:

I know this might seem illogical, but here it goes.

I have to distribute a binary (which in this case would be a webserver) to other engineers for testing. To keep it simple, because they might not be developers, I wanted to see if there might be some automated way to pack images into a GOLANG binary ? I've done this static HTML pages in the past, and it works great.

Obviously, at first run I could unzip to the file system, but to keep things clean I was trying to see if anyone has any thoughts how I could stuff them into a binary.

Any Ideas ?

答案1

得分: 3

你可以使用与HTML文件相同的工具...我假设你使用了类似以下的工具:

这些工具基本上会将你的文件转换为Go源代码,并提供类似http.FileSystem的API来读取你的数据。

英文:

You could use the same tools you used for HTML files... I'm assuming you used something like:

Which essentially transform your files in go source code and the expose an http.FileSystem-like API for reading your data.

huangapple
  • 本文由 发表于 2017年1月9日 08:02:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/41539276.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定