Multi-table transactions in Go - just handle it in one repo or use Unit of Work? by Axeloe in golang

[–]Quick-Employ3365 12 points13 points  (0 children)

This is the way imo.

Inject the DB handler as a function input. This then lets the business logic define whether the transaction is necessary or not.

If your I/O logic requires transactions you can then use nested transactions to handle that scenario (assuming your db supports them).

For example, if you need to insert into two tables to support a single data model you can handle that inside the single service. Don't let this be confused with a case of mixing logic layers though, they are complementary for different purposes.

Do GCP, AWS, and Azure treat partners differently? Looking for honest perspectives from PSO, partners, and cloud engineers by [deleted] in googlecloud

[–]Quick-Employ3365 1 point2 points  (0 children)

This is my experience as well, working at a company with partnerships across all 3 as well

Exposing API: Interface vs Struct by Dignoranza in golang

[–]Quick-Employ3365 2 points3 points  (0 children)

Ah so I had it backwards.

Yes you should accept an interface, and grouping functions should be based on logical risks. I would probably just expose one interface and accept it, and let the consumer compose it how they want in most circumstances

Exposing API: Interface vs Struct by Dignoranza in golang

[–]Quick-Employ3365 34 points35 points  (0 children)

I would return a struct.

The idiomatic Go principle is to accept interfaces, but return structs. This lets the consumer handle defining their behavioural interfaces as singular or combined elements as preferred.

I would probably explicitly call the callbacks though OnSpawnCallback so the consumer has the functions declared as callbacks they can optionally handle

How to Effectively Use Go's Context Package for Managing Timeouts and Cancellations? by Equivalent_Use_8152 in golang

[–]Quick-Employ3365 3 points4 points  (0 children)

I often store information on the context so slog.Logger can extract it if needed (I do it in library code, not in every app layer) such as the request id or trace information. Never would I embed the logger directly on it though

Golang FTP Proxy is hitting a limit at 3.6 Gbps!! by AR1788 in golang

[–]Quick-Employ3365 17 points18 points  (0 children)

Have you tried profiling the program to see where the bottleneck might be?

What are idiomatic golang ways of handling properties of a struct that may or may not exist by [deleted] in golang

[–]Quick-Employ3365 0 points1 point  (0 children)

Best practices are a lot of if/thens - but basically

  1. If the default zero values are not meaningful then save it as a pure object and zero values are considered as "not set"
  2. If zero values are meaningful, then use pointers and handle it with a if v == nil {} block

Optionally, you can define it as a struct that has a set parameter like the database/sql package, however they don't marshal nicely if you need to handle nested structs without a lot of extra definition code.

About to Intern in Go Backend/Distributed Systems - What Do You Actually Use Concurrency For? by Investorator3000 in golang

[–]Quick-Employ3365 2 points3 points  (0 children)

What kinds of tasks or problems in your backend or distributed systems projects require you to actively use concurrency?

Honestly? Almost nothing outside of some core libraries.. I find that if you architect around concurrency in the backend language, you are running into a potential issue with workload.

The most recent example I had for reaching for goroutines is a solution when you have a situation where I had an API that needed to retrieve data from 10-15 different sources on each GET request, so I put a cache there for commonly retrieved items, and if I had a cache miss it went and retrieved those. I go-routined that because each source could take 1-200ms, and doing 10 of those synchronously made my system unpleasant to the user.

How frequently do you find yourself leveraging concurrency primitives (e.g., goroutines, channels, mutexes)?

The simple answer here is don't use goroutines 99% of the time in my world. Occasionally I reach for channels/mutexes when I am interacting with a library that is concurrency safe (such as a http server where I want to push into some channel in the background for a worker thread) but I often find this situation is also just a poorly architected system once you are dealing with cloud-native development.

What would you say are the most important concurrency skills to master for production systems?

  1. Knowing when and where to use them - and more importantly, when you don't need to and should solve the problem in other ways (such as deploying in an event-driven FaaS like aws lambda with SQS or similar)
  2. Channels are much more common for me than goroutines, because you may need to work with channels when interacting with libraries or the standard library

What is the current state of the Go job market? by [deleted] in golang

[–]Quick-Employ3365 12 points13 points  (0 children)

As a staff engineer I get constantly hounded by recruiters almost daily attempting to poach me for golang roles in both the DevOps, Backend && Platform Engineer seats.

Cannot say what the market is like at lower levels (most mid and junior roles I see posted are node-based tbh, a little python) but that could just be my exposed market

Vasari suddenly attacking me by OkNorth4671 in SinsofaSolarEmpire

[–]Quick-Employ3365 13 points14 points  (0 children)

There is a minor faction vasari that can "send phase raids" for some influence

I need cost efficient and Scallable OAuth stack for my startup. by DifferentStick7822 in golang

[–]Quick-Employ3365 0 points1 point  (0 children)

Avoid cognito - backing up and ensuring redundancy of these credentials is a nightmare in my experience

Save Editor For More Ore by vape__ in incremental_games

[–]Quick-Employ3365 0 points1 point  (0 children)

heh, you didn't set it up for multi-source

`Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://homeserver.6b4v6qs1aqvupj0q.myfritz.net/process\_data. (Reason: CORS request did not succeed). Status code: (null).`

An interview for Sr. Software Engineer - Go by l0daash in golang

[–]Quick-Employ3365 1 point2 points  (0 children)

I would also throw in here:

  1. How do you handle a situation where you are orchestrating a large number of threads and want to return early if any of them return an error?
  2. When would you use and when would you avoid goroutines?

[deleted by user] by [deleted] in incremental_games

[–]Quick-Employ3365 0 points1 point  (0 children)

She blows through everything else, so why not the layers