News for hackers. Stuff that matters.
Re:Go at Digital Ocean by alain_gilbert on Sunday November 05, 2017 @04:44PM (#15631815)
The fact that the full url is used to import packages make it impossible to fork a repository.

Once you forked it, you have to change all the imports across the repo, and then it's kinda either very hard to make Pull Requests, or pull the new commits from the original repo.

This is one thing I really dislike about go dependencies.

If you have a solution for this, let me know, I would be very interested to know more about it.

But overall, I love go. I use it all the time anyway.

Re:Go at Digital Ocean by imsofuture on Sunday November 05, 2017 @05:04PM (#15631947)
You don't have to change the package name just because it's forked.

I threw together an example of doing this with `dep`. I forked Fatih's color package, and am using it as `github.com/fatih/color` no problem: https://github.com/sofuture/colortest (forked dep here: https://github.com/sofuture/color)

Re:Go at Digital Ocean by alain_gilbert on Sunday November 05, 2017 @06:37PM (#15632461)
As I said in my other comment (https://news.ycombinator.com/item?id=15632049)

It works for you because it's a small project and you are not actually importing other of your own packages inside it.

But if you look at "echo", it import some other "echo" packages inside of it.

Re:Go at Digital Ocean by imsofuture on Sunday November 05, 2017 @08:33PM (#15632940)
Okay, updated my example with `echo`. Check it out:

Using the original package name: https://github.com/sofuture/colortest/blob/master/main.go#L7

I can refer to my fork: https://github.com/sofuture/colortest/blob/master/Gopkg.toml...

Re:Go at Digital Ocean by alain_gilbert on Sunday November 05, 2017 @09:00PM (#15633022)
Oh I see.

Thank you for the example :)

Re:Go at Digital Ocean by imsofuture on Sunday November 05, 2017 @08:19PM (#15632884)
That doesn't matter is what I'm saying :) The package name of my fork isn't changed, and doesn't need to be, regardless of what else uses it. The only thing I had to do was specify 'use my fork's repo' in the Gopkg.toml file.

Edit: I'll fork echo in my example and show you.

Re:Go at Digital Ocean by s_ngularity on Sunday November 05, 2017 @05:09PM (#15631983)
You don't have to use the full url to import a package. The name of a git repository doesn't have to match the remote name though, so I don't see why it would be a problem to fork a repository.
Re:Go at Digital Ocean by alain_gilbert on Sunday November 05, 2017 @05:20PM (#15632049)
Let say I would like to fork "echo".

Echo is using some imports to their own packages inside the project.

IE: https://github.com/labstack/echo/blob/a098bcd3b0c445dde3d380...

So if I fork "echo", I have to replace the urls in their imports so it imports my fork packages.