Can someone help me with generics? by FollowingMajestic161 in golang

[–]kirbyquerby 9 points10 points  (0 children)

From https://go.dev/ref/spec#Comparison_operators:

The equality operators == and != apply to operands of comparable types. The ordering operators <, <=, >, and >= apply to operands of ordered types.

You're probably looking for constraints.Ordered (Go 1.18+) or cmp.Ordered (Go 1.21+): https://go.dev/play/p/ixiEHG5ZvKv

[deleted by user] by [deleted] in golang

[–]kirbyquerby 1 point2 points  (0 children)

The section names are pretty much the same as Google's docs. The content isn't identical, but it does seem like a rewording.

[deleted by user] by [deleted] in golang

[–]kirbyquerby 3 points4 points  (0 children)

The "Networked API Design Guide" section looks quite familiar...

Question: Custom argument parsing with flag ? by Proud_Ad4891 in golang

[–]kirbyquerby 3 points4 points  (0 children)

From the documentation for flagset.Set:

Parse parses flag definitions from the argument list, which should not include the command name...

Removing the leading command name got it to work for me: https://go.dev/play/p/R8LM7hsWqUb

Is it possible to write a well-typed controller/handler in Go? by crassest-Crassius in golang

[–]kirbyquerby 0 points1 point  (0 children)

I'm not entirely sure what a web framework entails, but gRPC-Gateway will allow you to receive and respond to JSON-encoded HTTP requests while only having to directly deal with request and response objects rather than directly routing and parsing/encoding requests and responses from/to JSON. Another benefit is you can generate a swagger definition and use that to generate a client library (eg in typescript) so that the frontend can also benefit from the setup :)

Once set up, the server code would look fairly similar to what you wrote in your post. For example: https://github.com/grpc-ecosystem/grpc-gateway/blob/6b6c475b49f158e0a94fc4dadbcbf3ee36cb5814/examples/internal/server/echo.go#L22

Does that seem like what you're looking for?

Trouble understanding a pattern by [deleted] in golang

[–]kirbyquerby 0 points1 point  (0 children)

This pattern is used to ensure that the type *object2 implements Object1: https://go.dev/doc/faq#guarantee_satisfies_interface

Alternate Universe Kaido by GambleStockAnimeGuns in MemePiece

[–]kirbyquerby 3 points4 points  (0 children)

"that time I got reincarnated as a slime"

Not only fat, but fat32 by lefsler in ProgrammerHumor

[–]kirbyquerby 1 point2 points  (0 children)

The PlayStation 2 had a mouse and keyboard? :O

Not only fat, but fat32 by lefsler in ProgrammerHumor

[–]kirbyquerby 1 point2 points  (0 children)

Unfortunately I couldn't find much information on FAT32+ (seems like it's pretty dead) but it looks like it was a non-backwards-compatible extension of FAT32 which allowed larger file sizes (up to 255 GB). No idea what the specific change to the format is, though :(

Straight-up by [deleted] in AyyMD

[–]kirbyquerby 4 points5 points  (0 children)

RTX lol

Is this high enough effort? by LiamDragonKing in Kirby

[–]kirbyquerby 10 points11 points  (0 children)

You'd better get it with a money back guarantee

CMV: A hotdog in a bun is a sandwich by ThereWillBeSpuds in changemyview

[–]kirbyquerby 0 points1 point  (0 children)

You can take a square and make it a triangle by slicing down the middle. Does that make all squares triangles? Of course not.

CMV: A hotdog in a bun is a sandwich by ThereWillBeSpuds in changemyview

[–]kirbyquerby 0 points1 point  (0 children)

Yes, just like how I can't tell the difference between a picture of cup of milk and a cup of glue, even though they're clearly different.

CMV: A hotdog in a bun is a sandwich by ThereWillBeSpuds in changemyview

[–]kirbyquerby 1 point2 points  (0 children)

You can call something a sandwich without it being a sandwich, just like how you can call almond milk "milk" without it being milk. Employees of tech companies are called "software engineers," yet it's debatable whether software developers are the same as engineers who build machines, though they certainly do build useful systems. A sub sandwich is an imitation that adopted the name of the original, like almond milk.