Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
83 views

Using go version go1.25.3 darwin/arm64. The below implementation is a simplified version of the actual implementation. type WaitObject struct{ c chan struct{} } func StartNewTestObject(d time....
Ahmad Sameh's user avatar
3 votes
0 answers
145 views

I’m trying to forward input from os.Stdin to a network stream in Go like this: go func() { for { if _, err := io.Copy(stream, os.Stdin); err != nil { log.Error(err) ...
Onyz's user avatar
  • 33
-2 votes
1 answer
85 views

I’m building a Go backend to control IoT motors via MQTT. Each device activation is handled asynchronously by a goroutine. Here’s the simplified flow: A client POSTs /activate-device with device_id ...
Musab Gulfam's user avatar
1 vote
1 answer
58 views

I am implementing a Zero MQ message listener service in Go, and I am struggling to find the most idiomatic pattern of processing those messages and storing them in a DB using Goroutines. I am ...
Sayak Mukhopadhyay's user avatar
1 vote
3 answers
279 views

I have a Go program that runs continuously, and I've noticed that both the number of goroutines and open file descriptors increase steadily over time (daily). However, the number of active network ...
tim's user avatar
  • 21
0 votes
1 answer
144 views

I'm trying to create some cron tasks to test out the https://github.com/go-co-op/gocron library. I'm exploring the singleton mode where if the same instance of a task is being executed, then it's ...
mmind's user avatar
  • 11
-3 votes
3 answers
172 views

I have a few convenience funcs and types in my utils package I use in several projects. They help me getting objects, array of objects from external apis via urls or custom requests (for auth api ...
vipaware's user avatar
6 votes
2 answers
147 views

Having a very simplified example (still I'm not sure it would be totally reproducible at any env) So there's a socket pipe func SocketPair() (*os.File, *os.File, error) { fds, err := syscall....
404's user avatar
  • 533
2 votes
1 answer
63 views

As I was reading the docs, I came across this line: GORM perform write (create/update/delete) operations run inside a transaction to ensure data consistency, you can disable it during initialization ...
Inderdeep01's user avatar
2 votes
1 answer
117 views

It is often said that coroutines could be thought of as "light threads" because they consume less memory. However, I wasn't able to find any explanation on why exactly that is the case. What ...
DiplomateProgrammer's user avatar
0 votes
0 answers
21 views

Env go version 1.18 gorm v1.25.2 Code My code in goroutine: type TaskThread struct { task *model.Task jobID uint64 } func (t *TaskThread) Start() { go t.run() } func (t *...
Sunnee's user avatar
  • 3
0 votes
1 answer
117 views

In Go I cannot figure out how to get the following setup. 1st level go routines should stop their 2nd level goroutines before they terminate. If the functionrunGoroutine is not in a loop (I don't ...
Ahmed Zaidan's user avatar
1 vote
2 answers
121 views

I ran into the next piece of code (simplified) and can't understand purpose of channel check. This snippet was found right before a function end. check := make(chan struct{}, 1) go func() { check &...
mymedia's user avatar
  • 626
0 votes
2 answers
92 views

I'm trying to understand why two similar pieces of code behave differently. Both snippets create a large number of goroutines that try to append to the same slice concurrently, which I understand is a ...
Husin Wijaya's user avatar
  • 1,457
0 votes
0 answers
56 views

Object I want to write a program that can block input from both keyboard and mouse with golang. However, there is a problem that I can only block input but cannot retrieve it when I use go func(). I ...
Psyyyy's user avatar
  • 11
0 votes
0 answers
73 views

I'm encountering a panic: send on closed channel error in my Go application when handling AMQP messages using context timeouts. Here is a simplified version of the code that reproduces the issue: func ...
Talha K.'s user avatar
3 votes
1 answer
253 views

I am using Watermill to develop software where I send a message, and it goes through service1, service2, and the last service. I use a slice to control the order of the messages (FIFO, as GoChannel ...
David's user avatar
  • 55
-3 votes
2 answers
260 views

I've made a program that scrapes all the pages of a website using goroutines: func main() { start := time.Now() knownUrls := getKnownURLs(os.Getenv("SITEMAP_URL")) var wg sync....
akopyl's user avatar
  • 299
0 votes
0 answers
86 views

I'm building a P2P file transfer system in Go that fetches chunks of data from peers in parallel. While sequential requests work fine, parallel requests using goroutines behave inconsistently, ...
Tarun Kavipurapu's user avatar
1 vote
1 answer
75 views

In "Sample 1" I close a channel inside the Wakeup goroutine. In "Sample 2" I close a channel inside the anonymous goroutine (in main function). If these two have exactly the same ...
user6277806's user avatar
-1 votes
1 answer
68 views

Unable to understand this dead lock situation in golang, i have below to go code with pub and sub pattern package main import ( "fmt" "sync" ) func main() { cond := ...
Hari's user avatar
  • 1,623
-1 votes
3 answers
173 views

I need to run parallel tasks based on an input array and wait for all of them to finish and process their response. My code waits for all the go routines to finish using wait group and then read the ...
Viral's user avatar
  • 383
1 vote
1 answer
332 views

I've read https://go.dev/blog/pipelines and there're two functions: // move numbers into a channel func gen(nums ...int) <-chan int { out := make(chan int) go func() { for _, n := ...
iwa2no's user avatar
  • 23
0 votes
0 answers
72 views

In an interview today, I got a problem to write a program with 2 goroutines to generate even and odd sequence and synchronize them to print the sequence of number. Later, I was asked how many routines ...
Eshant Gupta's user avatar
1 vote
1 answer
618 views

I have a very large CSV file that won't fit entirely into memory. I want to be able to read the file into chunks, and then chain a series of operations together to process the results. Lastly, I need ...
Adam G's user avatar
  • 77

1
2 3 4 5
36