Skip to main content

All Questions

Tagged with
3 votes
1 answer
331 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
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
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
538 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
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
0 votes
0 answers
185 views

What is considered as best practice for defining common types in golang?

We have set of common types (mostly structs, scalars, string IDs) that are used across different packages in a project written in Golang. Currently we define them in a package named "models" ...
oare234's user avatar
62 votes
10 answers
26k views

Does it ever make sense to use more concurrent processes than processor cores?

I've got some process in Go. Here's an example counting lines in text, though the question is meant to be far more general than this particular example: func lineCount(s string) int { count := 0 ...
TheEnvironmentalist's user avatar
6 votes
1 answer
2k views

How to test interactors in clean architecture?

After reading the last book from Robert C. Martin, I've tried a to develop some big Go applications following clean architecture. While writing interactors, I end up with a lot of complex unit tests, ...
luistm's user avatar
  • 163
5 votes
6 answers
5k views

Flow control in Go without a for loop

I've been set a challenge that I'm trying to get my head around, but am struggling with the best (or 'correct') way to implement it. The challenge is to create a simple console app written in Go that ...
Hexodus's user avatar
  • 77
2 votes
1 answer
233 views

TDD Duplicate Testing on Related Classes

In following the principle of testing only the exported functions on a package (using Go - or for others languages, the public functions on a class), I'm running into a scenario where related packages ...
Andy Brewer's user avatar
-8 votes
1 answer
374 views

Golang Testing Process [closed]

I am new to golang and RunC and now doing some research on it as a part of my intership. What kind of contents do the ' _test.go ' functions check during testing a program or a container with Golang (...
Sambhu's user avatar
  • 1
35 votes
4 answers
6k views

How much is Google investing in the Go language? [closed]

I have read quite a bit about the Go language, and it seems promising. The last important bit of information I am missing before I decide on spending more effort on the language is: How much money/man ...
David's user avatar
  • 4,449