Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED][NVM]Help adding vendor files to a go project
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2784

PostPosted: Mon Mar 03, 2025 2:18 pm    Post subject: [SOLVED][NVM]Help adding vendor files to a go project Reply with quote

Hi, I'd like to fork the original repo and add the vendor files so I don't need to deal with packaging and hosting them. Unfortunately I don't know enough about how go projects work. Can anybody land a hand? I believe once I do it I'll be able to do it on my own from then on.

UPDATE: I'm trying to automate the generation of vendor files with GitHub CI actions, but no luck yet.

UPDATE2: I've been a victim of some self-deception that made me look for such a solution to the wrong problem, disregard that thread.

Best Regards,
Georgi


Last edited by logrusx on Mon Mar 03, 2025 3:57 pm; edited 3 times in total
Back to top
View user's profile Send private message
spica
Guru
Guru


Joined: 04 Jun 2021
Posts: 347

PostPosted: Mon Mar 03, 2025 2:44 pm    Post subject: Reply with quote

If some module can not be fetched from internet, I use a local copy and use a `replace` directive in go.mod
Code:
module f.q.d.n/shop

go 1.22

replace f.q.d.n/image/proto/image/image_api_pb => ../image/proto/image/image_api_pb/

require (
        f.q.d.n/image/proto/image/image_api_pb v1.0.0
        ***
)


And then in the code I like that I do not need to change imports:
Code:
import "f.q.d.n/image/proto/image/image_api_pb"
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2784

PostPosted: Mon Mar 03, 2025 2:54 pm    Post subject: Reply with quote

Thanks, but I want to put that online for people to use. I have at least several tents of users and can't ask them to do that. For one release I used GitHub to host the vendor tarball, but they changed the scheme the URL is build and now it includes some weird random numbers which I can't predict in the ebuild. In the same time I don't want to go and update the URL for every new release. Of course that is an option too but I want to first try doing it properly. I'll also supervise upstream's actions and correct them if necessary as they are breaking my patches with stupid line swaps and such.

So far I've added vendor/modules.txt but go-module_live_vendor complains it's only allowed in live ebuilds.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum