I believe you should distinguish between the build and the run environment. Your build environment is largely defined by the language and its ecosystem, e.g. the vendor folder has a semantic for the Go tools. After the build you deploy the resulting artifacts to your run environment. That may be the go binary and files in a vendor folder. But the semantics of that vendor folder is different.
Sachin Puranik <sachin.pura...@gmail.com> schrieb am Fr. 18. Juni 2021 um 05:24: > Dear Gophers, > I have some more thoughts about the vendoring issue I observed earlier. > > Preface : > Basically while vendoring other than go files, nothing is copied in the > vendor folder(except the embed package). > It can be some Readme.MD, or some text file, or HTML templates. > > > Issue Details: > In the last email, thanks to Sean, she suggested that I use the > https://pkg.go.dev/embed package. > But I still see some issues. > 1. As per package description, this will work compile-time, which means > the files will be embedded in the binary and affect the size of the > artifact. > 2. Secondly I may want to use these files from the folder for different > purposes, ex: - I need not embed them, but as a part of my own build step I > collect all such dependencies from my module and move them to the common > serve folder from where they are served to the web. > 3. it could be literally any purpose. > > Ultimately I think it's the purview of developers on how to use those > files being part of the package, hence they should not be discarded by > applying smart compilation. > > > Now there is another associated problem, Let's say I add that manually in > my vendor folder, when I run 'go mod vendor', all these files are forcibly > deleted while updating and I am back to square one. > > Can you help to resolve this? > > Regards, > Sachin > > > > > On Mon, May 10, 2021 at 10:29 AM Sachin Puranik <sachin.pura...@gmail.com> > wrote: > >> Hi Sean, >> Thanks for the response. Though I am not sure if the solution satisfies >> my use case. I am doing some experimentation and will get back to you soon >> with the findings. >> >> Thanks and Regards, >> Sachin. >> >> On Sun, May 9, 2021 at 9:47 PM Sean Liao <seankhl...@gmail.com> wrote: >> >>> `go mod vendor` only includes what is needed to build your main module. >>> 1.16 has https://pkg.go.dev/embed so you can embed static assets (such >>> as template/html files) into your final binary >>> (they will also be available in the vendor directory but I don't think >>> this is your final goal) >>> >>> On Sunday, May 9, 2021 at 5:03:58 PM UTC+2 Sachin Puranik wrote: >>> >>>> Hi Gophers, >>>> I noticed the following issue while vendoring the library. >>>> >>>> Preface : >>>> Basically, I created the module, for myself. This module contains >>>> rendering templates and HTML files, few test files alongside the code. they >>>> are all tightly coupled to my module. >>>> >>>> Issue: >>>> when I use this module in another project as a vendor module, I noticed >>>> that all the code files are copied well, but all my test files, HTML >>>> templates, and files are completely ignored. They are not available in the >>>> vendor folder. >>>> >>>> Kindly let me know if there is an option to achieve this, or am I doing >>>> something wrong? >>>> >>>> Thanks in advance, >>>> Best regards, >>>> Sachin. >>>> >>>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "golang-nuts" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/golang-nuts/FAIN1fLonUc/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> golang-nuts+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/66c0b083-fd53-4c96-8541-60a0fc23a581n%40googlegroups.com >>> <https://groups.google.com/d/msgid/golang-nuts/66c0b083-fd53-4c96-8541-60a0fc23a581n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CANE8YwiLfiNw3XeEnPb%3DX0tD6%2B6--THe34YaChjdOLV%2BGWa3KQ%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CANE8YwiLfiNw3XeEnPb%3DX0tD6%2B6--THe34YaChjdOLV%2BGWa3KQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALWqRZrbWjDHnj4sC%3D5yekPHWy%2Bb28WwsvHhZEzBNbOZQfXFPw%40mail.gmail.com.