8,634 karma · joined Jun 23, 2011 (15y ago) · 7,679 submissions
comment 2y ago · link · parent
The filesystem hanging is unlikely to be a bug. The filesystems you'd realistically use in conjunction with Kubernetes are pretty heavily tested. More likely it is supposed to hang under whatever conditions has lead that to happen.
And, sure, maybe you'll eventually want to determine why the filesystem has moved into that failure state, but most pressing is that your app is crashing. All that work you put into gracefully handling the failing situation going to waste.
comment 2y ago · link · parent
That may get you through if there is only one x.Close, but now you have to offer the guarantee to the callers that there will only ever be one Close error returned. Furthermore, any callers of your function have to ensure that they don't end up introducing additional Close error returns in the same vein.
Without such guarantees, you, the caller, need to resort to string matching to protect against undocumented functionality and/or future modifications when you handle the error. Sounds like a rough situation...
> If I'm going to do something upstream based on the error, I use a type.
Implying that you are a lone wolf developer? I think you make a good point that if you exist in your own world without other developers just about anything goes.
That said, the language used around the previously linked repository implies that it welcomes other developers using and working on the code, so it is not clear how you are "doing the upstream" in all cases.
comment 2y ago · link · parent
Never has "who cares" been confidently said. It has always been asked "who cares?". And not asked in a vacuum either, but specifically asked alongside the question of what is to be gained from the knowledge of the error.
We now know that you allegedly care, which is a promising start. But you purposefully ignored the other question, which questions the credibly of your care. You can't meaningfully care about something if you don't know why you care about it, and if you knew you'd have told us about it already as it nonsensical to answer to the "who cares?" question alone, so...
comment 2y ago · link · parent
Realistically, you can't follow the standard library, except perhaps the newest additions. Idioms emerge and evolve with use. Much of the standard library was written before Go saw much use, being largely in place before the world got to see Go for the first time. Also, thanks to the Go1 guarantee, cannot be changed now.
If the aforementioned package was written in the 2000s, then it might be fair to say that it was in line with the idioms of the time. But it appears to have been written within the last year, and thus is not aligned with idioms of its age.
That's not to say it has to be. Idioms are not requirements. The "stringly-typed" design may be justified even knowing what we know in the 2020s. And, with that, we don't need to speculate about the justifications. We can let the author speak for himself as to why the choice was made.
comment 2y ago · link · parent
It is almost never the correct logic. The only time it might be appropriate is in a private helper function that has limited scope around another function.
It is most definitely not the correct logic if you are returning that from a public function! For many reasons, but especially because it now binds you to the implementation of the function you called forevermore. That is a horrible place to be.
For example, find out your os.File usage would be better served by SQLite? Too bad. You can't change it now because the users of your function have come to rely on errors from the os file operations when they handle the error you give them. Their code can't deal with the errors coming out of SQLite.
Instead, you need to return errors that are relevant to your function. It may be appropriate to wrap the source error in some circumstances, but your error structures should compel the user to rely on your errors, leaving the wrapped error only for things like logging where a change in the future won't break the callers.
comment 2y ago · link · parent
Like this?
switch {
case strings.Contains(err.Error(), "close thing foo"):
// deal with foo close error
case strings.Contains(err.Error(), "close thing bar"):
// deal with bar close error
}
And if so, what lead you or your organization to prefer "stringly-typed" errors over the idiomatic approach?comment 2y ago · link · parent
You are right that lying and bullshitting are different. A lie is a false statement with intent. Bullshit is nonsense with intent. A false statement and nonsense may share some similarities, but are ultimately different.
Perhaps nonsense is the word we should be applying to LLMs, but often what they say isn't nonsense, even if only by accident, so that doesn't exactly work either. Regardless, it doesn't matter now. As before, "hallucination" has moved beyond analogy and now has its own LLM-specific usage.
comment 2y ago · link · parent
If I recall, Kubernetes performs health checks over HTTP, so presumably your application is using the standard library's http server to provide that? If so, accept is full abstracted away. So, if that's crashing, that's a bug in Go.
Is that for you to debug, or is it best passed on to the Go team?
comment 2y ago · link · parent
If you find the error returned by f.Close to be significant, are you sure returning again it is the right course of action? Most likely you want to do something more meaningful with that state, like retrying the write with an alternate storage device.
Returning the error is giving up, and giving up just because a file didn't close does not make for a very robust system. Not all programs need to be robust, necessarily, but Go is definitely geared towards building systems that are intended to be robust.
comment 2y ago · link · parent
After they've fixed what they need to fix you need to use the information now being retained to narrow down why your app is crashing at all. Failing to open a file is expected behaviour. It should not be crashing.
Then maybe you can get around to looking at the close issue. But it's the least of your concerns. You've got way bigger problems to tackle first.
comment 2y ago · link · parent
You think you can build something at least as compelling as the iPhone from the ground up for less than $80 billion? Apple is spending $30 billion on R&D a year just to improve what they already have! Good luck...
And you only get one year to capitalize on that investment, more or less. By year two, without even more investment, the competition will have you smoked with their latest offerings. You might not even get a whole year if they see you as a credible threat. Nothing says the iPhone must be released on a yearly schedule.
comment 2y ago · link · parent
Isn't the lesson here: If you must have a Close method that might fail in your API, ensure it can safely be called multiple times?
As long as that is true, you can approach it like you would any other API that has resources that might need to be cleaned up.
f, _ := os.Create(...)
defer f.Close()
// perform writes and whatever else
if err := f.Close(); err != nil {
// recover from failure
}
(os.File supports this, expectedly)> the solution to this problem will be to use a WriteFile function
If it were the solution you'd already be using os.WriteFile. It has a time and place, but often it is not suitable. Notably because it requires the entire file contents to be first stored in memory, which can become problematic.
Certainly you could write a custom WriteFile function that is tuned to your specific requirements, but now you're back to needing to be familiar with the intricacies of a lower-level API in order to facilitate that.
comment 2y ago · link · parent
Delusion implies a degree of consistency, though. LLMs can be on point one minute and completely off the rails the next even when prompted with the same prompt. Hallucination fits better here as it speaks to the real-time "perception" (there's another one for you).
An LLM is not a brain, though, so no matter which analogy you choose, it will come with some flaws. Regardless, "hallucination" has moved past analogy territory and now has its own LLM-specific usage with reasonably wide acceptance so the analogy angle is now moot anyway.
comment 2y ago · link · parent
And you confirm that they work in an office environment, so that bit isn't in question. Perhaps you are confusing most with all? It is certain that not everyone sees "white collar" that way, but we're not talking about everyone.
comment 2y ago · link · parent
We're talking about a read-only case. os.Open returns a read-only file handle. If you try writing to it, you'll get an error already at that point. If close fails, who cares?
> I'm not sure how they would handle a file close failure
Ideally there is some kind of failover you can resort to, but if there is no other option at very least you will want to notify a human that what they thought was written isn't actually. But when only reading, you don't need to fall back to anything – all the reads were successful – and what is it to the human? What they thought was supposed to happen did!
comment 2y ago · link · parent
Certainly, in the write failure case where there is write failure you'd want to try writing to something else (ideally), notify someone that an operation didn't happen (as a last resort), or something to that effect in order to recover.
But in this case there is no need to try again and nobody really cares. Everything you needed the resources for is already successfully completed. If there is failure when releasing those resources, so what? There is nothing you can do about it.
comment 2y ago · link · parent
Office environment is key to what you say. That is why you would be considered white collar. The literal white collars may be gone, but what you call "dressing like slobs" is just a modern adaptation of the same white collar idea.
Now, as it pertains to tellers, banks are typically considered to be an office environment, thus why most consider them to be white collar.
comment 2y ago · link · parent
Banks are in the service industry (as is just about everything else; only resource extraction and manufacturing are excluded), so not just "more of". It is definitively a service industry position.
> like being a cashier.
The physical action of the work is a lot like being a cashier, but the environment in which the work is done is usually different, and that environment (especially with respect to the type of clothing the people usually wear within that environment) is what traditionally defines "white collar". As such, tellers are considered white collar by most people.
comment 2y ago · link · parent
func Open(name string) (*File, error)
Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.comment 2y ago · link · parent
But let's assume what the OP says is true. It is still not clear why anyone would do what you suggest? The investment required to be that player would be intense and knowing that you only have one product lifecycle to recoup it... Highly unlikely anyone is that daring. Competition sees players seek to be the winner, not the first loser.
comment 2y ago · link · parent
comment 2y ago · link · parent
But if the battery was working as well as it did when it was new, it is unlikely that the person would have started shopping in the first place. It is the catalyst that sees them move beyond "what I've got is good enough" to "this isn't serving my needs anymore".
comment 2y ago · link · parent
If anything, Costco's higher prices is more likely to suggest collusion (but still does not imply it).
comment 2y ago · link · parent
At the same time, you missed eggs and poultry, which are also under supply management like dairy. If we're to be technical it the milk/egg/chicken/turkey marketing board is responsible for managing the supply and therefore prices, which is decidedly not a government entity, but the existence is granted by the government so we'll give you that one.