Skip to main content

Questions tagged [golang]

The term sometimes used for the Go Programming Language, since searching for just Go is usually too broad.

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 ...
moshevi's user avatar
  • 139
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 ...
Person1's user avatar
  • 21
-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 ...
ProgramCpp's user avatar
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 ...
cylon86's user avatar
  • 111
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 ...
Big_Boulard's user avatar
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? ...
SRNissen's user avatar
  • 161
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 ...
Manuelarte's user avatar
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 ...
Daniel's user avatar
  • 119
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 (...
AndreaL's user avatar
  • 119
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 ...
Abyan Juang Kecci's user avatar
-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 ...
Felix Almesberger's user avatar
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, ...
selamba's user avatar
  • 109
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 ...
drkvogel's user avatar
  • 157
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 ...
JamesBoyZ's user avatar
  • 245
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 ...
Naftuli Kay's user avatar
  • 1,621

15 30 50 per page