Questions tagged [golang]
The term sometimes used for the Go Programming Language, since searching for just Go is usually too broad.
43 questions
3
votes
1
answer
330
views
why would one use the "Functional Options" pattern in go?
I just learned about the Functional Options pattern in golang.
what are the benefits of using it over just allowing to pass a config struct and just overriding the default values provided in the ...
1
vote
1
answer
115
views
Return function after kicking off background process
I have a process in golang that I want to kickoff through a RPC call but then have the function return early whilst the process continues in the background. Specifically it’s just a basic db transfer ...
-2
votes
1
answer
484
views
Go’s answer to c10k problem
I have few questions on the go's answer to c10K problem. How is an event loop different from the network poller described in this blog?
I see a striking similarity between waiting threads and waiting ...
1
vote
2
answers
1k
views
design pattern to avoid deadlock with mutex in golang
What would the appropriate design pattern to avoid deadlock when several functions use the same mutex ?
It is quite easy to forget what method uses the lock and so it happens that you call a function ...
0
votes
1
answer
546
views
Cheap But Effective Solution for Logging in a private rest microservices backend api
I've created a backend following a microservices architecture and now I need to implement logging.
my understanding
After reading some articles about this topic, I've listed below some "pretty ...
3
votes
1
answer
345
views
How are interfaces implemented behind the scenes in the Go language?
I have read this article which indicates a double tuple structure, but it is unfortunately light on implementation details, which is what I am looking for.
So... how are interfaces implemented in Go?
...
0
votes
1
answer
386
views
Cron job to read multiple "entities" from the database
I have one microservice (in GO) that needs to read a whole table every hour, filter out some data and send it to another application.
So as an example, imagine I have the following model:
type User ...
1
vote
1
answer
343
views
Creating a new type as slice of strings in Rust?
I have a little bit of experience with Go, that I have been trying to use as a reference point to wrap my mind around Rust via a cards game I wrote in Go that I would like to now write in Rust.
I know ...
0
votes
1
answer
537
views
Making side effects explicit even in non-pure functions
I try to have as many pure functions as possible, but if I can't, I at least try to make the side effects as explicit as possible.
Here is an example (in Go)
type State struct {
count int
}
func (...
1
vote
1
answer
371
views
How to solve duplicate request with Distributed Lock Management in Golang
I’m trying to test concurrently request (brute force test), with 1000 request/sec (same request id). I’m using Rest API.
The service running on distributed system, I’m using 3 pods.
The problem is I ...
-1
votes
1
answer
211
views
Writing a API for a hardware device for mutliple platforms
We want to create an API to communicate witha device we currently sell.
The API should be available for several platforms like C / C++ / .NET / Python and available for Windows and Linux.
The idea is ...
0
votes
2
answers
1k
views
Golang interface-implementation circular dependency
In trying to separate interface from implementation, I ran into a circular dependency problem.
There is a best practice in the world of Java: consume interfaces instead of concrete classes. That is, ...
4
votes
5
answers
1k
views
(How) can the circle-ellipse problem be solved by using composition rather than inheritance?
I was reading about composition over inheritance and came across a question about solving the Circle-Ellipse Problem in Object-Oriented Programming. This kind of problem is often used as an example of ...
2
votes
1
answer
178
views
How do we maintain consistent-read promise to clients + handling ID collision when using a fallback queue?
In my company, we are using Event Sourcing pattern to implement a storage for all changes to the price of a booking. Across the company, different services might try to append events to a booking ...
0
votes
2
answers
2k
views
Golang Design Pattern for Generating View Objects in a REST API?
I have moderate Golang experience and lots of experience in other programming languages such as Java, Python, Rust, Scala, and others. I'm comfortable with building REST services and most of the other ...