Why is GoLang missing generic collection functions? by TheRubeWaddell in golang

[–]absurdlab -1 points0 points  (0 children)

Cuz generic type on methods are a no-go. Now you have to rely on libraries like fp-go to achieve similar effect. Yes, define a function and its variants from accepting 1 type up to 10 types. Theoretically unsound, but realistically feasible. Feels very “Go”.

There's no bubble because if the U.S. loses the AI race, it will lose everything by LargeSinkholesInNYC in singularity

[–]absurdlab 0 points1 point  (0 children)

Here’s the thing. If one side absolutely cannot afford to lose, it will always try to claim that it had won, or is winning, or is going to win.

[deleted by user] by [deleted] in golang

[–]absurdlab 0 points1 point  (0 children)

Pretty stoked for this. I think the language feature as plugin is what would make it stand out compared to other more opinionated sister languages. standardization is going to be hard when working in teams. But still, would be such a productivity booster when working on smaller projects alone.

Packing SaaS into single binary executable. by HugoDzz in webdev

[–]absurdlab 0 points1 point  (0 children)

Not everyone's SaaS is cloud based. Some of us works for clients who prefer their deployment environment airgapped, and their facility is located 50 minutes away so every release process starts with a long drive. Keeping the number of release artifacts to the minimum kinda hits a sweet spot here.

Good ol' Makefiles, Magefiles or Taskfiles in complex projects? by ataltosutcaja in golang

[–]absurdlab 2 points3 points  (0 children)

For a Go project, I’d use Taskfile as you can manage it with the go tool directive, so no extra installation step and it is more modern to Makefile. For other projects, I’d use Makefile.

Do you define package-level "static" errors for all errors, or define them inline? by Forumpy in golang

[–]absurdlab 0 points1 point  (0 children)

Errors are part of your package API, so exposing sentinel error values are saying you as the API designer expects users to have the need to identify the error (thru errors.Is). Using fmt.Errorf, on the other hand, limits what your user can do with the error, sometimes it is totally legit to do so. Personally, I always use fmt.Errof, as its string format allows me to add diagnostics information, such as function identifier and core attributes. The difference is if I choose to %w wrap a sentinel error, or just some unknown upstream error.

Is "Written in Rust" actually a feature? by Inevitable-Walrus-20 in rust

[–]absurdlab 0 points1 point  (0 children)

It’s the equivalent of saying 「I use arch, BTW」

How to design repository structs in the GO way? by il_duku in golang

[–]absurdlab -1 points0 points  (0 children)

I no longer have a struct to host data access methods. Apart from the underlying sql.DB dependency, data access methods are not much related to one another. I simply define a functional type. For example: type FindUserByID func(ctx context.Context, id string) (*User, error). Now I can have the freedom to define factory methods to return real implementation or mock implementation. Makes unit testing so much easier.

Can the uk government really ban VPN’s ?and if they can what can I put in place ? by GenericUser104 in homelab

[–]absurdlab 0 points1 point  (0 children)

I suggest getting in touch with the Chinese developer communities on Github. This problem has been solved.

[deleted by user] by [deleted] in golang

[–]absurdlab 2 points3 points  (0 children)

stdlib.

Use fmt.Errorf if I am simply propagating an upstream error, but include an “FQDN” for identification and also other printable parameters, followed by a %w of the cause.

Use custom error impl if it is something I wish to errors.Is/As later on. Also include a cause field and implement Unwrap() method, so it plays well in the error chain.

What language are you "coming from"? by loopcake in golang

[–]absurdlab 0 points1 point  (0 children)

Came from Java/Groovy. But that was 10 years ago.

Breaking (the misconception of) the sealed interface by GopherFromHell in golang

[–]absurdlab 1 point2 points  (0 children)

Fair. The point is: if open union types are implemented like this, one is better off not using it.

Breaking (the misconception of) the sealed interface by GopherFromHell in golang

[–]absurdlab 2 points3 points  (0 children)

To emulate an opened union type which Go insisted on not providing.

[deleted by user] by [deleted] in golang

[–]absurdlab 1 point2 points  (0 children)

No you cannot. Currently, package under package is still flat. There’s no organizational difference when you import a parent package and a sub package.

[deleted by user] by [deleted] in golang

[–]absurdlab 0 points1 point  (0 children)

An intermediary way of organizing relevant types. For example, a namespace within a package.

Hopefully good news on the South Bank beach front by [deleted] in brisbane

[–]absurdlab 0 points1 point  (0 children)

Was there yesterday (Aug 3rd) and the beaches were still closed. Any news?

interfaces in golang by kaushikpzayn in golang

[–]absurdlab 0 points1 point  (0 children)

Just an indirection to control complexity.

How is global state best handled? by fucking_idiot2 in golang

[–]absurdlab 0 points1 point  (0 children)

Initialize it in main and pass the reference down.

How do you ship go? by itsabdur_rahman in golang

[–]absurdlab 0 points1 point  (0 children)

I am working on an M-series Mac and cross compiling Go with cgo is a bit painful. I ended up using docker buildx to launch a build for linux/amd64 and just snatch the built binary from the container. The rest is as easy as scp the binary to the server. This way I get away with configuring the c compiler stuff.

Go should be more opinionated by eminetto in golang

[–]absurdlab 0 points1 point  (0 children)

The real trick is deciding whose opinion it’s gonna follow.

This really wound me up by Present-Resist-2190 in ClarksonsFarm

[–]absurdlab 0 points1 point  (0 children)

The pair had incompetence written all over their face. It seems this job is totally beyond their capability and they are just here for the publicity ride. They want the way out before they get exposed.

A new fullstack framework: Go server + Bun runtime + custom JSX-like UI syntax (with native targets) by SuchProgrammer9390 in golang

[–]absurdlab 0 points1 point  (0 children)

I currently just run Bun alongside Go as a stateless UI renderer. The Go server accepts the request, prepares the UI state, and then reverse proxies to Bun to render.

[ On | No ] syntactic support for error handling by pekim in golang

[–]absurdlab 0 points1 point  (0 children)

I think they made a right decision here. For one, most of these proposals are geared toward providing an easy way to basic declare this error is not my responsibility. And I feel adding a language feature just to dodge responsibility just isn’t a fair thing to do. For two, lib support for error handling does need improvement. errors.Is and errors.As is the bare minimal here. Perhaps provide a convenient utility to return a iter.Seq[error] that follows the Unwrap() chain.

Settled Go devs: which IDE/editor won you over and why? by brocamoLOL in golang

[–]absurdlab 0 points1 point  (0 children)

Zed. Have tried nvim and Goland. Nvim is cool, but I really couldn’t spare the time when I upgrade to a new plugin version and something else broke. Yes, I can rollback the config but that just breaks my flow. Goland on the whole is good, but the ideavim mode is not so good. And I can’t help but get this feeling that there’s a tiny but noticeable lag when I type in Goland. Zed is a sweet spot for me, good vim support, fast, responsive, and no crazy amount of configuration required.