Thanks for the suggestion.

I think the replace method works, but it is some tedious.
I need to add a "go.mod" file for each of the subfolders under "oldvendor",
and add a line in the "go.mod" of the main module.

But it looks this is the only way which works currently.
It would be great if there is a simpler way to support both
always-on vendor and cached vendor at the same time.

On Tuesday, September 10, 2019 at 12:30:56 PM UTC-4, t hepudds wrote:
>
> Hello T L,
>
> I think I might not fully understand the exact scenario, but one thing 
> some people have done when they have something in their vendor directory 
> that they can't otherwise find anywhere else (e.g., perhaps because it is 
> modified, or maybe the only copy of a now-missing dependency is in your 
> vendor directory) is to rename the vendor directory to something else 
> ("oldvendor", or whatever name makes sense), and then set 'replace' 
> directives in the main project's go.mod file to point into the "oldvendor" 
> directory for whatever pieces from there are needed.
>
> For example, something like:
>
>    require github.com/some/dependency v0.0.0
>
>    replace github.com/some/dependency => ./oldvendor/
> github.com/some/dependency
>
> I think that would allow you to pick and choose what you want from your 
> old vendor directory.
>
> In terms of your other question, I think -mod=vendor is currently all or 
> nothing. There is a proposal to perhaps one day support partial vendoring, 
> but that is not in the current software.
>
> Regards,
> thepudds
>
> On Tuesday, September 10, 2019 at 8:59:28 AM UTC-4, T L wrote:
>>
>> I maintain an private old Go project, which depends many many old 
>> packages.
>> Before the module mode, I put all these dependency packages under the 
>> vendor folder.
>> In the developing process, from time to time, I modified some of 
>> dependency packages.
>>
>> Meanwhile, I plan to migrate the project to modules mode and need to 
>> import some new module packages.
>> I found I encountered an embarrassing situation.
>> If I delete the vendor folder and run "go mod vendor" in modules mode to 
>> rebuild the vendor,
>> the command will fail. One reason is some dependency packages disappeared.
>> The other reason is many packages are updated and broke capabilities.
>> And I don't want the new download to overwrite my local modifications for 
>> some dependency packages.
>>
>> So, is there a way to let me continue use the these old dependency 
>> packages and use some new modules based packages?
>>
>>

-- 
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/39f0b51b-3b0b-434e-a784-254b0f6bca47%40googlegroups.com.

Reply via email to