How to participate in a golang project, since go get is version locked?

I’ve gotten as far as go get -v -u something but sometimes that “something” is a project I’d like to participate in, and contribute to. Go puts the source code in something like GOPATH/pkg/mod/something-releaseversion/ which obviously isn’t the version people are currently working on. I tried “something@latest” but that only got the latest release version, and “something@branch” removes the branch name, and replaces it with a time specific, cryptographic hash specific snapshot like “something@v0.2.2-0.20211008105725-6ed085b1eb77”. The moment I change one letter of source code, it’s a new commit hash, and a new timestamp, and maybe even a new version. So how do I get “something@branch” that keeps up to date with the latest version at that branch, which other people may also be contributing to?

I tried ignoring the name and just pretending like I could edit the source code inside “something@v0.2.2-0.20211008105725-6ed085b1eb77” but I couldn’t figure out how to rebuild anything. “go get -v -u something@master” just leaves the currently built stuff, and “go build” just tells me things like cannot find package "go.mindeco.de/log" even though it never pulled that package in the initial “go get.”

I feel like I’m missing something super simple here.

Is it just clone the project you want to work on without “go get” and run “go get” inside the cloned directory? What if you need to work on a dependency, but don’t want to publish the changes until you’re sure it works in the parent project?

Oh, if I’m already hacking the parent project, I could just temporarily change its go.mod file like…

replace example.com/theirmodule v0.0.0-unpublished => ../theirmodule

…to depend on any dependencies I am also working on, personally. That would clutter up revision history with all that crowbarring, but I think it might at least work.

When you say participate, do you mean you want to work on their source code and submit pull requests after making bug fixes/adding features? If so, I found a page, here, that I think describes the basic process, however, whatever specific project you’re attempting to contribute to may have their own process(es).

Oh sure, I know how to use github’s “Let’s add vendor lock-in to the process of asking someone to accept our aid” pull requests. I just meant how do I get “go” to get its dependencies, and build a project, following a branch from some repository?

It seems like what I have to do is ignore “go get” and instead clone the project manually, then in that project directory, run “go build somewhere/something.go” for each command. It gets the dependencies that way and recompiles the command, though I have to manually figure out just which files correspond to which commands.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.