News for hackers. Stuff that matters.
Re:Effective Go by rplnt on Tuesday April 26, 2022 @11:27AM (#31168672)
What I would like is an official guide on how to set up go environment on various platforms. The language is stable, but tooling went through so many radical changes that most of the guides out there are outdated. And setting it up as you go just results in a messy setup.
Re:Effective Go by tptacek on Tuesday April 26, 2022 @01:06PM (#31170071)
At this point, is there much to know? You install Go, you start your project in a directory, you run "go mod init" in it, and that's it.
Re:Effective Go by throwaway894345 on Tuesday April 26, 2022 @01:40PM (#31170559)
Getting your editor up and running is still a mixed bag. "Install VS Code + plugin" sort of works, but you're likely to have a ton of bugs with the plugin that need configuration tweaks to work around (e.g., "try the LSP backend"). Hopefully stuff will stabilize as workspaces and generics stabilize.
Re:Effective Go by Thaxll on Tuesday April 26, 2022 @02:01PM (#31170875)
Setting up VSCode takes 2min and has 0 issues. You have nothing to do beside installing the official Go plugin.

Debugging etc ... juste works out of the box.

Re:Effective Go by throwaway894345 on Tuesday April 26, 2022 @02:23PM (#31171154)
This hasn't been my experience at various points in the past, but admittedly my most recent foray was a few months ago.
Re:Effective Go by usrme on Tuesday April 26, 2022 @11:37AM (#31168848)
I'm just starting out with Go, but how has the official guide[1] failed you? Genuinely curious as it seems to cover both new installations and the management of multiple versions.

---

[1]: https://go.dev/doc/install

Re:Effective Go by ses1984 on Tuesday April 26, 2022 @11:57AM (#31169082)
What do you do if you're working on a go project and you need to fork one of its dependencies? Or the project you're working on is a fork?

https://stackoverflow.com/questions/14323872/using-forked-pa...

There are a lot of different approaches listed in here that have changed over time. Different projects evolve at different rates. You might need to become familiar with multiple old ways of dependency management to be really effective.

Re:Effective Go by CraigJPerry on Tuesday April 26, 2022 @12:32PM (#31169557)
Not a Go developer (but i really admire their devops-friendly toolchain and general ethos of keeping things simple).

I went to https://go.dev/doc/

I clicked on "Managing Dependencies" -> "Requiring external module code from your own repository fork"

And arrived at:

https://go.dev/doc/modules/managing-dependencies#external_fo...

Assuming that information is correct - and i'm not in a place to judge that, i just don't have the knowledge unfortunately - that journey felt pretty short and discoverable.

Re:Effective Go by ses1984 on Wednesday April 27, 2022 @11:02PM (#31188312)
Go modules were apparently released right after I changed jobs and stopped using go at work.

Apparently I’m remembering the old hell.

Re:Effective Go by p2detar on Tuesday April 26, 2022 @12:38PM (#31169632)
Are there really that many mainstream projects that use alternative dependency handling? Go modules were introduced in v1.11 and they seem pretty mature.

The replace directive seems to solve the issues with forked projects in particular. [1]

1 - https://github.com/golang/go/wiki/Modules#when-should-i-use-...

Re:Effective Go by Philip-J-Fry on Tuesday April 26, 2022 @12:52PM (#31169839)
Clone it, update the consumer go.mod with a "replace" directive to point the dependency at your fork.

I don't understand how this is still a problem for people to understand. It's been the standard for literally years now.

It's actually even better now that go workspaces are a thing.

Re:Effective Go by martinskou on Tuesday April 26, 2022 @01:41PM (#31170577)
Re:Effective Go by marwatk on Tuesday April 26, 2022 @01:09PM (#31170125)
I haven't messed with them yet but 1.18 add workspaces [1]

This is definitely a pain point I've had with golang and the 'accepted' process has changed 3 or 4 times in the last 2 years.

1: https://go.dev/doc/tutorial/workspaces

Re:Effective Go by icholy on Tuesday April 26, 2022 @01:19PM (#31170275)
> the 'accepted' process has changed 3 or 4 times in the last 2 years.

No it hasn't.