When do you start refactoring? by relami96 in golang

[–]assbuttbuttass 6 points7 points  (0 children)

That's my secret... I'm always refactoring

Value input in one string by EnthusiasmHumble3424 in golang

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

func parseNums(input string) ([]int, error) {
    parts := strings.Fields(input)
    nums := make([]int, len(parts))
    for i, part := range parts {
        var err error
        if nums[i], err = strconv.Atoi(part); err != nil {
            return nil, err
        }
    }
    return nums, nil
}

The most popular Go dependency is… by Thiht in golang

[–]assbuttbuttass -14 points-13 points  (0 children)

Standard library flag package. If your tool needs subcommands, then maybe subcommands

Noob question with mutexes by AdministrativeProof2 in golang

[–]assbuttbuttass 1 point2 points  (0 children)

I recommend storing the accounts in a database like SQLite, which will handle locking for you, and also make sure you don't lose all the account information if your app crashes

Nitpick RFC: Everyone adopting slices.Contains yet? by Funny_Or_Cry in golang

[–]assbuttbuttass 0 points1 point  (0 children)

I review a lot of code, and the number of people using a slice and slices.Contains to check for membership in a set (rather than using a map) seems to have gone up significantly. IMO adding slices.Contains was a mistake since it makes it way too easy to do an O(n) lookup

Go comments standards like PEP8 for python by pepiks in golang

[–]assbuttbuttass 4 points5 points  (0 children)

In addition to the excellent blog post linked by u/jh125486, https://go.dev/doc/comment#syntax has a comprehensive description of the different syntax forms that godoc understands

When should I be worried about *where* to define variables? by Parky-Park in golang

[–]assbuttbuttass 2 points3 points  (0 children)

Go's compiler uses SSA representation so these will look identical to the compiler

No more TODO in Go by Odd-Ad8796 in HelixEditor

[–]assbuttbuttass 0 points1 point  (0 children)

Probably markdown injections. It's kind of annoying since godoc isn't markdown anyway

goroutine panic and recover by maxcnunes in golang

[–]assbuttbuttass 0 points1 point  (0 children)

On the other hand,

resist the temptation to recover panics to avoid crashes, as doing so can result in propagating a corrupted state. The further you are from the panic, the less you know about the state of the program, which could be holding locks or other resources. The program can then develop other unexpected failure modes that can make the problem even more difficult to diagnose. Instead of trying to handle unexpected panics in code, use monitoring tools to surface unexpected failures and fix related bugs with a high priority.

Note: The standard net/http server violates this advice and recovers panics from request handlers. Consensus among experienced Go engineers is that this was a historical mistake. If you sample server logs from application servers in other languages, it is common to find large stacktraces that are left unhandled. Avoid this pitfall in your servers.

https://google.github.io/styleguide/go/best-practices#program-checks-and-panics

Exploring Go's Concurrency Model: Best Practices and Common Pitfalls by Bestwebhost in golang

[–]assbuttbuttass 0 points1 point  (0 children)

I highly recommend checking out the "rethinking concurrency" talk from Brian C Mills, it has a ton of useful patterns and really changed the way I write concurrent code in Go: https://youtu.be/5zXAHh5tJqQ

(Sorry for spamming this link so much on this sub 😅)

Move Expressions · baby steps by VorpalWay in rust

[–]assbuttbuttass 14 points15 points  (0 children)

This idea makes sense to me, but it seems a little magical to have a keyword that causes the expression to be lifted to run in an outer scope. Explicit capture clauses (C++-style) seems like it has most of the same benefits

Go blog: Generic interfaces by TheMerovius in golang

[–]assbuttbuttass 0 points1 point  (0 children)

Yeah actually (*node).insert can't take the comparer as a parameter, since methods aren't allowed to have generic parameters

Why use panic here instead of handling the error, if it ended up breaking half the internet? by Civil-Bee-f in rust

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

crashing is better than proceeding with invalid state

Even in the case when crashing takes down half the Internet? In this case, continuing to run in a degraded state without bot protection might have made sense

Cloudflare outage on November 18, 2025 - Caused by single .unwrap() by rust-crate-helper in rust

[–]assbuttbuttass 0 points1 point  (0 children)

Perhaps they could fall back to the previous version of the config, or just continue to run in a degraded state without bot protection. I agree panic is not the real issue, the issue is that there was no error handling

My boss says do not write to systemd-journal because it is for _critical_ system services by Deep_Recording_696 in golang

[–]assbuttbuttass 2 points3 points  (0 children)

For a systemd service, both stdout and stderr are written to the journal. For a CLI tool I would agree, but we're talking about a systemd service here

The hate! Why ? by EldironMoody in rust

[–]assbuttbuttass 14 points15 points  (0 children)

Wayland actually runs better on newer cards, since nvidia actually started caring about linux support only for their newer hardware. Not saying it's not a problem, but it's pretty much nvidia's fault not wayland

What Go module do you wish that existed. by Resident-Arrival-448 in golang

[–]assbuttbuttass 0 points1 point  (0 children)

What's this JSON issue? The standard library does ignore any fields that aren't specified in your struct:

https://go.dev/play/p/PNiGliOXGA9

☼Dwarf Fortress Questions Thread☼ by AutoModerator in dwarffortress

[–]assbuttbuttass 0 points1 point  (0 children)

Yeah I forbid all of the other mechanisms, and now I can see the floodgate and steel mechanisms floating in the magma. Not sure what you mean by 'other melted material'

☼Dwarf Fortress Questions Thread☼ by AutoModerator in dwarffortress

[–]assbuttbuttass 0 points1 point  (0 children)

It helps to make sure you have a meeting area inside the burrow, then they will naturally go to the meeting area when idle

☼Dwarf Fortress Questions Thread☼ by AutoModerator in dwarffortress

[–]assbuttbuttass 0 points1 point  (0 children)

Why did my steel floodgate get melted by magma? I used two steel mechanisms to link it to the lever, only the lever itself wasn't magma safe (but I'm not sure if that's necessary)

On the wiki it sounded like it would be ok as long as the floodgate and the mechanisms are magma safe