|
In Java-like languages, I'm accustomed to catching exceptions, then throwing a new exception in a "chain" so that I get information about every level of the stack trace. Does Go have this capability? I haven't found one, so I've created this pattern in my modules instead:code:
|
# ¿ Jan 15, 2018 16:35 |
|
|
# ¿ May 11, 2024 07:50 |
|
Those are helpful, thanks. I knew I couldn't be the only person who wants to do this.
|
# ¿ Jan 15, 2018 19:14 |
|
I don't understand why I'm getting a segfault while trying to query my database. Here's a minimal example that segfaults at conn.Exec:code:
e: turns out you have to import _ "github.com/go-sql-driver/mysql" spiritual bypass fucked around with this message at 02:47 on Feb 26, 2018 |
# ¿ Feb 26, 2018 02:32 |
|
Anyone encountered a problem where pprof starts in interactive mode and then quits immediately without providing a prompt?code:
I'm trying to figure out why a short set of database tests take about 1s each to perform some basic inserts and reads on an empty MySQL database. It seems absurdly slow compared to what I'd expect from other languages and how the database performs at an interactive prompt.
|
# ¿ Jun 10, 2018 15:46 |
|
Thanks, I wasn't even aware of that option. e: After using trace, it turns out it wasn't even the database access. I'd written tests that all involve checking user passwords and I'd forgotten that bcrypt is, of course, very slow. In fact, it involves something called expensiveBlowfishSetup spiritual bypass fucked around with this message at 00:44 on Jun 21, 2018 |
# ¿ Jun 20, 2018 12:27 |
|
Basically every natively compiled language except C compiles all the same-language libraries into the binary
|
# ¿ Aug 15, 2018 02:52 |
|
Are there any tools available to automatically generate a module file for an existing project? I'd really like to ditch this GOPATH stuff, but I also don't feel like enumerating my dependencies by hand.
|
# ¿ Sep 7, 2018 14:22 |
|
Eela6 posted:If you're using modules, `go build` will do what you want automatically Oh, I just need a go.mod and the compiler handles the rest? That's lovely
|
# ¿ Sep 7, 2018 18:18 |
|
I encountered a little issue, but it was easy, really. Took me 20 minutes to switch my project to modules. My project is located in GOPATH, so I had to set an env var to make it work. I took way more steps than this but then filtered out the ones that weren't really necessary:
Now you're cooking with modules. Skip the GO111MODULE var if you're outside the gopath. Too bad the docs for this are all focused on theoretical bullshit instead of "here's how to use it"
|
# ¿ Sep 8, 2018 19:30 |
|
iirc the dep guy is a reject from the Drupal world which is funny because Drupal ignored the one thing PHP got right, dependency management with Composer. Now Go has a Composer-like solution instead of whatever the hell dep was trying to do.
|
# ¿ Sep 8, 2018 22:56 |
|
Can you put the definition into a git submodule?
|
# ¿ Sep 14, 2018 02:30 |
|
Anyone ever seen the SQL library panic under high concurrency? I'm running a load test on a reasonably simple API backend and I start getting lots of panics once I pass about 250 req/s. Seems kinda bizarre to me, but there's still more investigation to do...
|
# ¿ Feb 20, 2019 01:48 |
|
No, it doesn't detect anything in this case. But it turns out doing defer rows.Close() before handing the error on the Query() means you're invoking a method on a potentially nil rows which is obviously a good time to panic Now it's time to move the error handling sooner in the sequence and run my load test again. Then I'll know what the actual database errors are and handle them appropriately. Feels good to get over this speedbump after crossing so many little hurdles on this particular idiot spare time project.
|
# ¿ Feb 20, 2019 22:49 |
|
Why can't I successfully compare two strings from a url.Hostname()? When I run this code: code:
code:
e: welp, upon posting this I realize that linkUrl is not fullUrl
|
# ¿ Jun 7, 2019 21:13 |
|
|
# ¿ May 11, 2024 07:50 |
|
What advantage does singleton provide over passing in the logger and DB connections (or storage providers) as args? In my opinion, it's always better for a web server to instantiate things at startup time instead of attempting to do it in a handler. This way you can write tests and benchmarks with full confidence that all of the needed pieces go in as args instead of having to remember to set up other state beforehand.
|
# ¿ Sep 20, 2020 16:51 |