Whats about to compile JavaScript libraries for http use?

I don’t know if it is a good idea to compile text files into the program. Some comments about that usage would help me a little bit.

I made a simple package for vuejs
Package see here:

The package offers a handlefunc, which makes it very easy to add the vue.js library as a route. I compiled the whole vue.js text file into a []byte, because of chars like ` " and I did not want to change anything inside the vue.js text. The big pro is that I don’t need extra text files, when installing my server. Everything would be compiled into the program.

But I am not sure if that way is not a bad idea. Something smells here, but I don’t know what. So what do you think about that idea?

Not smelly at all, if you ask me - see Awesome Go: Resource Embedding.


Update to my own comment - there could be a caveat with resource embedding - see this Golang-Nuts thread at Google Groups.

TL;DR: When code contains large tables of data, compiling needs lots of memory (at least on Windows).

Thank you

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.