Questions tagged [go]
Go, also called golang, is an open source programming language initially developed at Google. It is a statically-typed language with syntax loosely derived from that of C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.
                175 questions
            
            
            
                5
            
            votes
        
        
            
                2
            
            answers
        
        
            
                1k
            
            views
        
        
            
            
        Repository and Service Interfaces in an Accounting Software in Go with Uncle Bob's Clean Architecture
                    I'm trying to get hands-on experience with Uncle Bob's Clean Architecture in Go, but I'm running into some issues. Also, I'm not yet familiar with all of Go's idioms.
For testing purposes, I'm ...
                
            
       
        
            
                3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                583
            
            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
        
        
            
                112
            
            views
        
        
            
        Go, Error Handling, and Big Text Files - express error semantics in types
                    The title Go, Error Handling, and Big Text Files is a blog post from Wesley Aptekar-Cassels from 2021. In this blog post he reports about a problem he faced parsing long text files. He tried
scanner :=...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                504
            
            views
        
        
            
        How to handle different json response for the same api rest endpoint and different http status
                    I have an endpoint similar to GET ../produtcs/123 where 123 stands for an ID. The REST service response
with either status 200 and a json object A {"deliveryData": {"status": 200, ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                257
            
            views
        
        
            
            
            
        Is there any logical reason to "store" just one object file (.o) into archival file (.a)?
                    As far as I understand (not much), the archival .a file is just, roughly speaking, the collection/batch of object .o files. It's like a library of compiled code that can be cached and which can be ...
                
            
       
        
            
                0
            
            votes
        
        
            
                2
            
            answers
        
        
            
                240
            
            views
        
        
            
            
        Seeking a Third Opinion on Kafka Consumer Implementation and Architectural Disagreements
                    I've been at my current job for about 4-5 months, mainly working with Go, and I have no prior experience with Kafka. Before this, my background was in JavaScript, Node.js, React, etc. I recently got a ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                132
            
            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
        
        
            
                537
            
            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
        
        
            
                0
            
            answers
        
        
            
                133
            
            views
        
        
        golang: pattern for handling message queues? Are named functions anti-idiomatic somehow?
                    Had a discussion today in how to implement services that work with messages coming in from event queues. We call these services processors. One of us argues for using several functions, while the ...
                
            
       
        
            
                0
            
            votes
        
        
            
                4
            
            answers
        
        
            
                3k
            
            views
        
        
            
            
        Should Golang 'private' methods need unit tests?
                    I'm relatively new to Go but I come from a C#/OOP background where unit testing private methods isn't something that's generally done. I currently have a senior developer telling me it's "bad ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                214
            
            views
        
        
            
            
        High Throughput Concurrent Map Access and Periodic Updates Causing Contention and Latency Spikes
                    I am working on a Go application where two concurrent maps, products and productCatalog, are accessed by numerous threads in live traffic to retrieve data at high throughput. These maps are populated ...
                
            
       
        
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                105
            
            views
        
        
            
        Domain-Driven Design: Storage layer and MySQL client
                    I'm very new in DDD and I was following one of the videos of GohperCon to structure of my Golang App using DDD with Hexagonal Architecture. At the lowest (deepest) layer is the storage that can be ...
                
            
       
        
            
                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
        
        
            
                596
            
            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
        
        
            
                392
            
            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?
...
                
            
       
         
         
         
        