you can skip the error checking in go as well its the same everywhere.
>another thread by an underaged nocoder who doesn't like handling errors because it looks ugly so he thinks its not important
>>106127609>>106127651its 2025
i want the computer to take care of that shit for me
>>106127651Anyone saying this unironically should be beheaded for criticizing Java's verbosity.
>>106127417 (OP)This is a great feature of Go as it actually makes you think about how to handle error cases instead of just blowing up. The nice second order effect is that it filters low quality develops (jeets specifically).
>>106127686java is just too verbose. whine about go's error handling all you want, at least i don't have to write a piece of scripture every time i want to make a new class.
No reason to use go when C# with AOT and channels exists
>>106127417 (OP)The snippets for all the other languages are just ignoring errors, you can do that in Go too.
>>106127658if the computer does it for you youre not programming
The difference is the Go code requires an explicit crash while the other examples will crash automatically due to the unhandled exceptions. Isn't there a way to map the JSON to a struct in Go anyway, skipping a lot of these checks, or is that inappropriate here?
>>106127797yes i am
i am the creator
and if my shit has errors i want computer to catch them and tell me where they are so i can work on fixing them
>Go babies don't know about null aware syntax
That's why I love Go, I handle errors and wrap them with meta info and debugging is a breeze with a stack trace
>>106127783Isn't panic(err) essentially just "throwing" the error?
>>106127831no
panic is just for unexpected fatal shit
>>106127815Yes it can, the stdlib json package can parse json for you using struct tags.
OP is a jeet and it shows, never use (((blogs))) instead visit the official go website for the one source of truth in how to use the language.
>>106127783They aren't "ignoring" the error, they're propagating the error to the caller without modifying it. Yes, you can do that in go as well... as the code sample clearly shows.
>>106127850Ah, so basically the same as letting a console program in an exception based language crash without catching anything
>>106127831Yes but better handling would require the same amount of lines.
My point is that the other languages are just doing print(result) below the call, and you can make the Go snippet as short as the others by doing print(res, err) without an if
>>106127856>they're propagating the error to the callerWhich will have to handle it by writing more code, that is not shown there.
>>106127871or you could just _ blank the err and pretend like it doesnt exist
>>106127856>they're propagating the error to the caller without modifying it.What a crock of shit. They're throwing invisible exceptions. It only "propagates" if you bother to handle it. Or you crash.
>>106127417 (OP)Go is bad because handling errors is bad?
>>106127417 (OP)thanks for proving why Go is used in production cloud systems
We're currently hiring Gochads, remote USA.
https://job-boards.greenhouse.io/runpod/jobs/4142227008
>>106128550nobody sane would want to work with americans
yes you pay more than europeans but its not worth it if the price is to deal with americans, american boss and american managers and soullessness
still makes more sense in most cases than try catch. try catch is generally faster when no errors are thrown, but it feels gross to write them. i write a lot of c++ and i wrote a templated container that
behaves a lot like go error handling. it behaves like an std::optional when it contains a value, but if it does not contain a value it contains an error which can be accessed with a method. it is essentially a wrapper for std::variant that cleans up the boiler plating.
>>106127658so fork it and add the feature you want?
>>106128978computer is not open source
>>106129126desu there are a lot of autists here who would fit the personality required of a cloud infra/systems engineer
>>106127903which can handle all the errors with a single try catch, which is roughly the same amount of code as a single go error check, or propagate it to their caller with zero additonal code, whereas go will need yet another if err != nil dance
>>106127923>It only "propagates" if you bother to handle it. Or you crash.you have a global exception handler in your main loop which reports the error. Same as what happens after the long chain of if err != nils in go.
>>106127417 (OP)Go only looks more verbose when you're not properly handling every single error like you should. The equivalent would be putting each line inside a try catch block, what's wrong with err != nil instead?
>>106127417 (OP)Go people care about error checking unlike everyone else (it seems) and you think this some kind of a dunk on them? lol
whats
if err != nil {
return nill, err;
}
wrong
if err != nil {
return nill, err;
}
with
if err != nil {
return nill, err;
}
that?
if err != nil {
return nill, err;
}
>>106128766I have only one catch in my entire >100K LOC codebase. And my "error handling" code? I just repeat method call several times.
The main source of catches are transient IO errors like files being locked by other process (like in my case), or network errors.
>>106127417 (OP)>every other example ignores errorsjeet or mental retardation
call it
>>106127701Java itself isn't that verbose, the fucking culture around it is the issue
> NO U CAN NOT HAVE A PUBLIC FIELD IN A CLASS U HAVE TO MAKE IT PRIVATE AND CREATE GETTERS AND SETTERS FOR ITwhy? Because in that one case...
also clean code mental illness
>>106131412You can't ignore error in real programming language.
>>106127816wow, a real AI artist in the wild
>>106127417 (OP)SAAR DO NOT REDEEM THE IF ERR != NULL SAAAR YOU BLOODY BENCHOD *braaaaaaaaap*
>>106127693If someone passes my program incorrect input, it's a skill problem on their part and not my responsibility
>>106127417 (OP)is that... le hecking error handling? AAAA im going insane CHATGPT SAVE ME!
>>106127750All this C# shilling made me want to test it out and fuck, it is beyond terrible. I've never seen such a botched ffi as the one C# has. Calling raylib functions from C# yields about the same performance as fucking Python using a jit. I can't think of a usecase for C# beyond generic web backend #30323912919291 and even then it doesn't stand out as particularly great. It is truly corporate slop.
>>106127417 (OP)why is there no ruby in there, literally best DSL language
>>106131878The only way to ignore an exception is to catch it ("to handle it" in go terms). Catching, "swallowing" exceptions is considered bad practice.
>>106132930https://github.com/dotnet/runtime/issues/19708
this thread mentions the overhead of
>4.1 ns/call
How come this guy wants to argue about Go all the time anyway? Is he gay?
>>106133075probably some google shill, obviously their language is so shitty they need to do marketing for it
>>106132707Are gojeets incapable of comprehending that other languages have sane ways of error handling, like checked exceptions and Result<T, E>, that don't involve checking err == nil every two lines?
>>106127417 (OP)What happens if you just don't check for the error?
>>106132946Tried the same test. got 2ns/call
>>106133408Checked exceptions are superior to if err != nil in every way possible, but your tiny Indian brain could not possibly comprehend how. You get paid per line of code because you are a worthless jeet slave.
>>106132930>overhead of between 10 and 30 x86 instructions per callisn't this normal when you save all registers to stack?
>>106130894that is mostly where i utilize this class. io operations are bound to be so fucked that you need verbose error handling, more than just a nullptr(std::optional). you can throw specific errors and handle them by unrolling the stack, or you can just return a valueless object with an error. also it looks much cleaner than the try catch(foo) catch(bar) catch(...)
>>106132780I used it to code a proxy server for a game protocol which is very latency sensitive. That sounds more like a skill issue.
>>106127417 (OP)Golang winning as usual, java and cshart saars are angry about it, grass is green and the sky is blue
>>106127417 (OP)>redishow are we all feeling about Valkey?
>>106134884it's literally Redis without the retarded licensing
>>106134949redis had all this shit about vector stores?
>>106127686the java/C# equivalent would be to put every function in a
try {
function();
} catch (Exception e) {
exit(-1);
}
not nicer than go at all. the only difference is that with go you have to explicitly say i don't want to handle the error by using a discard result, _ = function() while in java/C# you have zero clue what can throw what kinds of exceptions. Did you know that anytime you use the new keyword it could fail with an OutOfMemory? do you put all new usages in try catch blocks? java/C# error handling is just selectively ignoring 3/4 of them.
>>106134175>Webshitting where i/o the biggest limiting factor vs processing large amounts of raw data and using ffi where data structure implementations and raw compute is the biggest limiting factor. I know you are brown but try harder. Even Python would be fine for your usecase. Webdevs are not human.
>>106127417 (OP)It's hilarious how exceptions are literally superior to how go returns errors and as equally weakly typed as exceptions as well. I honestly don't understand what go heads were thinking when they designed their shit system.
>>106135422the java/C# equivalent would be doing nothing, because you get this behavior for free
>>106135422>java/C# you have zero clue what can throw what kinds of exceptions.Have you heard of checked exceptions saar?
Microsoft wrote the TypeScript troonspiler in Go and not C# or C++ or Rust because Microshit has no white engineers anymore, only street shitting benchod pajeets who can only understand their benchod jeetlangs like Go. Do not redeem you bloody bitch bastard!
>>106137414Microsoft is a hydra. don't attribute direction to a beast that moves in every direction simultaneously.
>>106132359you reckon a program should just crash due to "skill" issues that you could have prevented?
>>106137548dont argue with midwits and jeets
>>106130066>you have a global exception handler in your main loop which reports the errorI'm looking forward to even more airplanes nosediving due to software bugs very soon
>>106137707Go was literally invented to tard wrangle jeets from making buggy code in C++. Keep projecting Ranjeet.
>>106137389The entire point of exceptions is that it's an open set of errors with types unknown at compilation time, which makes it easy to write modular software. If you expect something, it should be a part of result, like http status code.
>>106137707god, imagine letting a bunch of gojeets write airplane software. at least java is halfway workable when it's white men programming it.
>>106127417 (OP)why not add a single character syntactic sugar for panic(err), return err, and other common error handling?
>>106135603>networking programming >webshitYou just outted yourself as a no coder and by your response a retard, which proves my initial point.
>>106137872odin does this with
FuncThatCouldError() or_return;
// and
FuncThatCouldError() or_else { //handle error }
>>106137763>>106137850the cope on this board from java jeets is really strange. nobody posted like this on /g/ ever until this year. how is college going bro?
>>106138107>muh OdinBuy an ad.
>>106137779That is literally what a checked exceptions is, the exceptions a function can throw is literally part of its signature.
>>106138469>The key point here is our programmers are Googlers, theyโre not researchers. Theyโre typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. Theyโre not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt. โ Rob Pike DO NOT REDEEM YOU BLOODY BENCHOD!!!
>>106139362No one mentioned functroon languages, Prajesh? Take your fucking meds.
>>106139409I hope you're not retarded enough to seriously think that by "brilliant language" he meant Java.
>>106139447No one claimed Java was a genius language? But at least Java is elegant and expressive in comparison to Go, and that is the only point I need to make.
mfw
md5: 5906629b0139d8ea1f7eb34e18b6bb33
๐
>But at least Java is elegant and expressive in comparison to Go
holy fuck i can't even with these underaged newfags
Seen as there is no /wdg/ I'll ask ITT.
Has anyone built a music website and if so where can I download royalty free music from?
Only need like 4 or 5 albums but more would be good. Just want to make sure the music is 100% free to use because I'll be hosting it on netlify. Will obviously give links and credits to the artists.
>Java
>elegant
>expressive
>in comparison to Go
holy fuck my sides
>>106139557>vibecoding gojeet uses vibecoding to prove xer pointdo not fuckin redeem benchod
>>106139557You forgot to check if err != nil at line 10, 11, 12, 14, 15, 17, 18, 19, and 22.
>>106139637>retard>>106139716>schizoThe natue of the opposition reveals itself.
>>106139744>no arguments>no argumentsBehold, the smartest gojeet.
instance Monad (Either e)
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World!")
}
func main() {
http.HandleFunc("/", handler)
fmt.Println("Server starting on :8080")
http.ListenAndServe(":8080", nil)
}
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
public class BasicHttpServer {
public static void main(String[] args) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);
server.createContext("/", new MyHandler());
server.setExecutor(null);
System.out.println("Server starting on :8080");
server.start();
}
static class MyHandler implements HttpHandler {
@Override
public void handle(HttpExchange exchange) throws IOException {
String response = "Hello, World!";
exchange.sendResponseHeaders(200, response.length());
OutputStream os = exchange.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
}
>even after shitting out vibecoded hallucinations the java implementation is still 100 times more readable and clean than the street shitted gojeet implementation
gojeets lost, again
>>106139907nobody is actually this retarded
Oh wow, this thread that we literally have everyday.
>>106127417 (OP)the issue is?
not having exception is actually a pro...
>>106139841that's just different levels of abstraction. nothing prevents you from wrapping java code in few functions, exactly like in go example.
Java:
>readable like English
>simple and self-documenting
Go:
>verbose but not self-documenting
>unreadable due to if err != nil everywhere and obnoxious control flow
Funny how you can tell what % of /g/ is employed based on threads like these.
>>106135441yes, given the disproportionate attention Go threads get here
>>106140269Just introduce more abstractions through function soups like you do in Java
>>106140524>wtf is this codeBait for retards. They're pretty abundant here.