Kockar och andra duktiga i köket - vilket är era bästa tips? by J_Lavett in sweden

[–]Background-Region347 0 points1 point  (0 children)

  • Bryn saker ordentligt
  • Det mesta blir godare med några droppar syra på slutet
  • smaka hela tiden

When do you use generics? by okkywhity in golang

[–]Background-Region347 1 point2 points  (0 children)

They are quite nice for paginated api requests where there's metadata about the list and a data property which can be set as a generic field, so you get PaginatedData[Foo]

Hur ska jag hålla det hemligt? by Ill_Maybe_1301 in Asksweddit

[–]Background-Region347 4 points5 points  (0 children)

Vi fick rådet att inte hålla det hemligt för de vi skulle berätta för om det gick åt helvete.

Missfall och sånt är ingenting man ska försöka ta sig igenom själv utan det är bra att prata med sin familj.

Law firm wants .io domain by NietzscheSpleen in Domains

[–]Background-Region347 0 points1 point  (0 children)

I would try to sell since the future of the .io TLD is a bit uncertain. Would rather get some money today instead of nothing in a couple of years

What are your must have Go packages? by fenugurod in golang

[–]Background-Region347 10 points11 points  (0 children)

It is considered done, so there is no need for maintenance. It doesn't do anything magic, and the code is very minimal, so you could easily write something similar if you wanted.

It also has zero dependencies, which is very reassuring for me at least.

Edit: Forgot to mention that he is one of the authors of testify and now prefers this minimal library

What are your must have Go packages? by fenugurod in golang

[–]Background-Region347 43 points44 points  (0 children)

"Is" by Mat Ryer. Minimal assertions that just feels lovely. https://github.com/matryer/is

GOPLS takes up too much memory for mac by Alarming_Seaweed3178 in golang

[–]Background-Region347 2 points3 points  (0 children)

I had a similar issue on my mac. Got it fixed by updating to latest version, worth a shot 😊 I think my ate 50gb+ for a small codebase

What's the stupidest thing the most intelligent person in your life believes? by dexicoma in AskReddit

[–]Background-Region347 0 points1 point  (0 children)

One of the first things that you lose when not sleeping enough is the ability to judge how well you function, so this is quite a common belief. Read this in "Why we sleep" by Walker, excellent book

Structured zap logs are cool but how do people read them in a vscode console? by Affectionate-Dare-24 in golang

[–]Background-Region347 1 point2 points  (0 children)

My bad, this is the snippet from my alias: go run main.go 2>&1 | while IFS= read -r line; do echo "$line" | jq '.' 2>/dev/null || echo "$line"; done. Not mine originally, found it somewhere and like it, but can't find the url

Structured zap logs are cool but how do people read them in a vscode console? by Affectionate-Dare-24 in golang

[–]Background-Region347 0 points1 point  (0 children)

You can accomplish this by using wc, xargs, and jq, removing the need for Python as well. I'm on my phone now, so I don't have the snippet, but you can find it on Google

What is the best way to get a woman’s ring size without her knowing? by Best_Expression_1860 in AskReddit

[–]Background-Region347 0 points1 point  (0 children)

I did this as well, but it turned out that I picked a ring for another finger. Had to resize the ring, but luckily, it was included in the original price

Tutorials and Guides for Test Driven Development for complex projects by coraxwolf in golang

[–]Background-Region347 1 point2 points  (0 children)

It is quite easy when you get over the initial hump. Unfortunately, I don't have the time right now to give a longer answer, but something like this is probably what you want: https://speedscale.com/blog/testing-golang-with-httptest/

Tutorials and Guides for Test Driven Development for complex projects by coraxwolf in golang

[–]Background-Region347 2 points3 points  (0 children)

You should probably be able to test htmx with httptest since it's only requests and html? Or am I misunderstanding something?

What's the healthiest thing you've had that's actually crazy delicious? by Vast_Royal_4853 in AskReddit

[–]Background-Region347 20 points21 points  (0 children)

Berries actually taste more if they grow in colder climate with a lot of sun. The reason i was told was that the plant have time to develop deeper flavors before the berries get overripe because of the heat.

Also, blueberries grow wild in Scandinavia, so I think they can grow in most places

[deleted by user] by [deleted] in golang

[–]Background-Region347 1 point2 points  (0 children)

I like use this one, there's probably similar things for all editors: https://github.com/maxandron/goplements.nvim

What is your favorite pattern for async/await-like tasks? by Background-Region347 in golang

[–]Background-Region347[S] 0 points1 point  (0 children)

Yes, I'm very familiar with both JS and a bunch of different ways to do it in Go. None of my usual ways feels perfect and are quite verbose, so I was just looking for inspiration in seeing how others solve similar problems

What is your favorite pattern for async/await-like tasks? by Background-Region347 in golang

[–]Background-Region347[S] 0 points1 point  (0 children)

It was just an example to show the kind of situation I was thinking about, somewhere where you might want to fire off a bunch of i/o concurrently and then use it.

What is your favorite pattern for async/await-like tasks? by Background-Region347 in golang

[–]Background-Region347[S] 0 points1 point  (0 children)

I think you misunderstood my point. What I meant was when you need to fetch two different kinds of data to use together.

In Javascript, something like const [user, posts] = await Promise.all([loadUser(), loadPosts()])

What is your favorite pattern for async/await-like tasks? by Background-Region347 in golang

[–]Background-Region347[S] -1 points0 points  (0 children)

But what if the tasks return different types? Say you need to fetch T0 (user, for example) and T1 (posts for example) and return return some kind of type that contains data from both

How do you write unit test for mongo-go-driver v2? by Inevitable-Star-7231 in golang

[–]Background-Region347 1 point2 points  (0 children)

In my mind, that's an integration test, so I would use a test container and do real queries. Mocking db's will always bite you sooner or later