This seems like a good Idea...I will try and let you know soon.

Thanks,
Sachin.

On Fri, Jun 18, 2021 at 6:16 PM jake...@gmail.com <jake6...@gmail.com>
wrote:

> I don't use vendor, so I'm just thinking here. If I understand correctly,
> a "//go:embed" statement will cause the the target file to be included in
> the vendor. If that is the case, then perhaps you could create a
> vendored_files.go file that embeds all the files you want vendored, then
> add a build tag to the file so it never actually gets built into your
> executable?
>
> I have not actually tried this, but it seems like it should work.
>
> On Thursday, June 17, 2021 at 11:25:22 PM UTC-4 Sachin Puranik wrote:
>
>> 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....@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 <seank...@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...@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 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/b195ade1-dede-46a5-b18c-9289a822ee4bn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/b195ade1-dede-46a5-b18c-9289a822ee4bn%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/CANE8Ywgi8ai06TCpYPyVKPXBL5d6ZOYEM6Y%2B8dWxARDtY_ATzA%40mail.gmail.com.

Reply via email to