question about go install and webapp structure

20 views
Skip to first unread message

Yan Dai

unread,
Jan 21, 2015, 8:18:40 PM1/21/15
to gola...@googlegroups.com
Hi,

I have question about go install and a go webapp structure.

Currently, I have a webapp which the project structure is look like:
                                     myproject/
                                              bin/

                                              src/
                                                   mygoproject/
                                                                       main.go
                                                                       views/
                                                                                 index.gtpl

Then I do go install inside the mygoproject/. There will be binary file built in the /bin folder. However, the web pages in views is not copyed to bin/.
When I run the binary file in the bin/, it will not found the webpages and throw exceptions so I have to manually copy the views/ folder to the bin/.
Is this correct?should the vies also be included in the binary file?

regards,
Yan

Evan Shaw

unread,
Jan 22, 2015, 4:23:55 AM1/22/15
to gola...@googlegroups.com
Yes, this is correct. go install only deals with Go code and binaries.

If your app needs other files to work, then you should either include those files in the binary (maybe using the new go generate command) or don't use go install (directly, at least).

--
--
* You received this message because you are subscribed to the Google Groups "golang-nz" group.
* To post to this group, send email to gola...@googlegroups.com
* To subscribe from this group, send email to golang-nz...@googlegroups.com
* To unsubscribe from this group, send email to golang-nz+...@googlegroups.com
* For more options, visit this group at http://groups.google.com/group/golang-nz?hl=en-GB?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "golang-nz" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nz+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages