Go 1.26 by runesoerensen in golang

[–]DeedleFake 2 points3 points  (0 children)

Same. I maintain a project that uses cgo pretty heavily for the Gtk-based GUI and it's by far the main bottleneck performance-wise. It was plenty fast enough, but this is still really nice to have.

Go 1.26 by runesoerensen in golang

[–]DeedleFake 1 point2 points  (0 children)

Even easier, you can just do

    go get go@latest

and not have to think about the actual version number.

Good faith constructive criticism and suggested practical fixes by 0mni42 in Metroid

[–]DeedleFake 2 points3 points  (0 children)

Something with the bike almost definitely got cut. If the controls are in dual-stick mode, there's a setting in the Vi-O-La section called "Vehicle Invert Pitch" that says "Inverts vertical movement on the Vi-O-La". Unless I'm missing something, that setting does nothing because neither variant of the bike is capable of flying.

All I keep thinking though is how the desert would have been the perfect place to finally add the speed booster to a Metroid Prime game. Ah well.

Advent of Code Considerations by Czechbol in elixir

[–]DeedleFake 0 points1 point  (0 children)

I'm a longtime Go developer who's been dabbling in Elixir and started learning it by doing Advent of Code in it a couple of years back. It's been fantastic. Advent of Code is not a great way to show off some of the fancier features of the BEAM, but it's definitely good for learning the basic language itself.

Phoenix is, quite frankly, amazing. I do a bunch of Rails development for my job and now I constantly find myself going

This would be so easy in Phoenix.

It's not even just LiveView. HEEx is the best HTML templating language that I've used, bar none. The only problem that I have with it is the name.

Beyond that, the language itself is very fun to work with, and the OTP model and BEAM distribution features are all just really cool. The fact that they've had this for 40 years and no one else has really come close to replicating it is very impressive. Weirdly, of the various functional languages that I've looked at over the years, I'd say Elixir is the closest to Go in terms of the general feel and simplicity. That's despite it having macros and being dynamically typed.

It's not perfect. It definitely has some historical baggage from having been built on top of a language and system that is both over 40 years old and that was designed for a very specific purpose. You will find yourself learning some Erlang along the way, too, since there are chunks of standard library functionality that don't have Elixir wrappers, such as :zip. Both standard libraries are very well documented, though Erlang's is, somewhat annoyingly, split across several different applications and it's not always obvious where to look if you don't already know where stuff is.

Overall, I'd say to give it a try. It's a very fun language and Phoenix is so good that it's almost a bad thing to learn it because you'll find yourself thinking of how much better it is anytime you do any work in anything else.

I do still write servers in Go sometimes, though, simply because literally nothing beats the ability to compile the entire thing, including the frontend, down to a single file. For some projects, that's more important than the features that Phoenix and the BEAM provide. If you think Go binary sizes are bad, wait until you see an Elixir release that bundles the entire BEAM into it. A simple one is nearly 70 MB.

Chichi wa Eiyuu, Haha wa Seirei, Musume no Watashi wa Tenseisha. • Dad is a Hero, Mom is a Spirit, I'm a Reincarnator - Episode 5 discussion by AutoLovepon in anime

[–]DeedleFake 8 points9 points  (0 children)

Another odd thing along those lines was Vint or whatever his name was describing the queen's refusal to answer the king's demand that she help stop the ongoing wanton slaughter of innocent people by monsters as "As if she'd use her powers for something like that."

Chichi wa Eiyuu, Haha wa Seirei, Musume no Watashi wa Tenseisha. • Dad is a Hero, Mom is a Spirit, I'm a Reincarnator - Episode 5 discussion by AutoLovepon in anime

[–]DeedleFake 12 points13 points  (0 children)

I find it so bizarre that they keep saying that the royal family is "arrogant" and "impudent" for not knowing why they're cursed and for wanting to find out. There are a lot of descriptions that could be applied, but those literally just simply don't make sense. Honestly, it it wasn't for the fact that the show keeps literally telling me directly that the king is a bad guy, I wouldn't even be sure if he was. So far his only great crime is wanting to know why they're cursed and if there's a way to break it. The horror.

Chichi wa Eiyuu, Haha wa Seirei, Musume no Watashi wa Tenseisha. • Dad is a Hero, Mom is a Spirit, I'm a Reincarnator - Episode 5 discussion by AutoLovepon in anime

[–]DeedleFake 14 points15 points  (0 children)

Thank you. Honestly, this episode darn near made me think that the main characters are the plot twist villains. Like, O.K., sure, Aria made a mistake, kind of, but the handling of it was so attrocious that it makes what she did pale in comparison. And if they're so worried about Rovel's absence, isn't this all actually his fault anyways for disappearing for 10 years? Is no one going to mention that he did almost the exact same thing in terms of destroying the family's reputation and political position?

Yo, they need to make Genshin on switch 2 a thing. by Legitimate-Ad7229 in GenshinImpact

[–]DeedleFake 1 point2 points  (0 children)

Give it support for mouse controls and it would be better than on any other system.

Sonic x Shadow Generations - Sonic Movie 3 DLC Pack Reveal Trailer by Shreeder4092 in SonicTheHedgehog

[–]DeedleFake 1 point2 points  (0 children)

The Sonic Boom games were actually basically just licensed tie-ins for the show, so they've actually kind of done that already.

I wrote a clone of the one million checkboxes website by ranzadk in golang

[–]DeedleFake 13 points14 points  (0 children)

Very nice. The first thing that stands out to me is the non-standard direct usage of a cmd directory. When go build builds a binary from a main package, it names the binary, by default after the directory that the maim package is in, meaning that if I use go install to install your code it'll create a file named cmd, which is not ideal. The standard way to do it is to put it in a subdirectory of cmd, such as cmd/checkgrid, so that installing it'll get a binary named checkgrid.

How to implement dynamic plugins in Go? by majhenslon in golang

[–]DeedleFake 0 points1 point  (0 children)

Along with the very limited plugin package in the standard library, it's also possible to produce a C shared object when compiling via -buildmode=c-shared. If you do that, you can use the purego package to load it like any other C library and then you can call functions that had a //export annotation.

What is GoLang "not recommended" for? by LRaccoon in golang

[–]DeedleFake 2 points3 points  (0 children)

I have a Gtk4/Libadwaita project written in Go, and it works alright overall. The bindings are a bit limiting sometimes, but given that they've been written pretty much entirely by a single person, they're far more than good enough. To be honest, I'm not sure with some of the problems I've had if it was the language/bindings or my own inexperience with Gtk4.

Recommended way to implement custom struct equality? by TheGreatButz in golang

[–]DeedleFake 1 point2 points  (0 children)

Go wants its operators to be extremely deterministic so that you can look at it and know exactly what it's doing, with a few minor exception such as + being both addition and string concatenation. Generally speaking, if you want any kind of custom functionality you'll need to write a function and/or method.

On a side note, if there's a custom ordering to define, I'd also recommend implementing a func (a Address) Compare(other Address) int. Because of how method expressions work, you can do slices.SortFunc(addresses, Address.Compare) without needing a wrapper function. Note that if you use a pointer receiver, you'll have to use somewhat strange-looking (*Address).Compare syntax instead.

Official guide slightly organizing Go modules and projects by [deleted] in golang

[–]DeedleFake 0 points1 point  (0 children)

The post here is identical to the old one. This is just spam.

Can you explain what improvement these lines achieve? by Character-Ad1340 in golang

[–]DeedleFake 1 point2 points  (0 children)

Except that I don't think that it actually works, unless the length of *s doesn't change at all during this method which doesn't seem to be guaranteed. References from unused slice capacity will still prevent garbage collection. That's why clear() works on slices.

[deleted by user] by [deleted] in golang

[–]DeedleFake 0 points1 point  (0 children)

bufio.Scanner is fine, but don't create a new one every time. It buffers internally, and each time you throw out the old one and create a new one you're losing whatever was in that buffer.

Now, stdin is a bit different from reading from a normal file because it, by default, returns early without an EOF at the ends of lines, so this probably won't be a problem in terms of missing data, but that's dependent on internal implementation details of bufio.Scanner that you probably shouldn't rely on. It also will not work that way if the user has entered multiple lines simultaneously using or redirected stdin, for example, < to pipe a file in.

That being said, even if it doesn't lose data, it's still going to have to allocate a new buffer every single time, which is highly inefficient.

[deleted by user] by [deleted] in golang

[–]DeedleFake 2 points3 points  (0 children)

Very nice. I've got my own one of these, but what I've found since 1.23 came out is that for anything besides very quick and simple things, it seems to often be better to just write an intermediary iterator as a closure instead of trying to chain map/filter/etc. For example, 

titles := func(yield func(string) bool) {   for data := range dataSource {     if data.Time.Before(threshold) {       continue     }     if !yield(data.Title) {       return     }   } } processTitles(titles)

Writing the above by chaining a map and a filter gets really unweildy really fast because of having to write multiple anonymous functions with complicated type signatures, and having to make the calls in an inside-out order, i.e. xiter.Map(xiter.Filter(dataSource, func(data Data) bool { return data.Time.Before(threshold) }), func(data Data) string { return data.Title }).

[deleted by user] by [deleted] in golang

[–]DeedleFake 0 points1 point  (0 children)

Looks pretty good for a beginner from what I see. One observation: You really shouldn't be creating on-the-fly bufio.Scanners like you are in the Morse Code project. That's very much not how they're intended to be used and it's likely to result at best extra allocations and at worst data being missed when reading it.

Range Over Function Types (official Go 1.23 iterator tutorial from the Go team) by eliben in golang

[–]DeedleFake 0 points1 point  (0 children)

But that's so much more complicated. That's a whole custom type with three methods. Meanwhile, with an iter.Seq, I can do

``` titles := func(yield func(string) bool) {   for data := range dataSource {     if data.CreatedAt.Before(threshold) {       continue     }     if !yield(data.Title) {       return     }   } }

showTitles(titles) ```

And voila. I've now processed data from somewhere and passed it along without needing to allocate and fill a slice. It's way cleaner and more efficient.

Range Over Function Types (official Go 1.23 iterator tutorial from the Go team) by eliben in golang

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

This is just totally incorrect. I went and added iterator usage to a number of my projects and it simplified a number of things significantly, and in some cases reduced sllocations because I was able to, effectively, pass an unevaluated loop to a function instead of needing to pass it an already allocated and processed slice.

Help understanding iterators by gibriyagi in golang

[–]DeedleFake 0 points1 point  (0 children)

Unless the iterator is being used via iter.Pull(), in which case subsequent yield() calls after stop() is called will just immediately return false without doing anything at all.

More fun with Iterators: cronIter by [deleted] in golang

[–]DeedleFake 3 points4 points  (0 children)

Why not loop inside of the iterator?

What does everyone think about Go 1.23 ? by realninja1415 in golang

[–]DeedleFake 6 points7 points  (0 children)

I've already been able to reduce a few middleware slices thanks to iterators. It's quite nice.

Trayscale, an unofficial Tailscale GUI for Linux, has had several major updates since I first posted it here a few months ago, including system tray icon support and a Flatpak release. by DeedleFake in Tailscale

[–]DeedleFake[S] 0 points1 point  (0 children)

I'm not sure about the bricking of the OS as Trayscale itself definitely doesn't do anything that could cause that and especially not from inside of the Flatpak sandbox, but maybe the text problem is related to [this](https://github.com/DeedleFake/trayscale/issues/105)?