Closed warmans closed 9 years ago
I'd prefer if this were added to doc.go instead. But yes! I've wanted to do this myself because I forget exactly how it works unless I can see some code.
Sure. I've moved the example to the godoc. I think my editor has tried to standardize the whitespace. If this is an issue I can change them back to tabs.
I think a more concrete example is needed:
1) create main.go as described
2) run esc -o static.go main.go
, which will embed main.go into static.go
3) run it
4) hit http://localhost:8080/main.go
This will also require changing the handler path to just /
.
Or maybe this is too weird and not useful since it doesn't include a directory, which is the expected case?
And yes, please fix the whitespace to tabs.
I've tried to clarify the process as per 1/2/3/4. I think just embedding main.go slightly obscures the common use of the library as I believe most people would have their static assets in a sub-directory. Admittedly the upside is that it does allow the example to run without creating random directories.
Thanks.
I like this library but I would have found it easier to get started with an example such as this.