74,398 questions
0
votes
0
answers
37
views
how do you use the retryablehttp.DefaultBackoff in go?
using this: https://pkg.go.dev/github.com/hashicorp/go-retryablehttp?utm_source=godoc#DefaultBackoff
I thought it might be something like:
client := retryablehttp.NewClient()
client.Backoff = func(...
0
votes
1
answer
27
views
F-Keys in Windows don't result in update in bubbletea
While used to C# /.Net, I am quite new to go and bubbletea and I am trying to do a little cli helper for my private amusement.
Now, what I am trying to do is bind F2 Key to an update action in ...
1
vote
0
answers
20
views
Implementaiton of Watches for controller using kubebuilder
I am trying to implement watches in Golang for my controller of Kubernetes resources based on example presented in kubebuilder page (https://book.kubebuilder.io/reference/watching-resources/secondary-...
2
votes
0
answers
46
views
headless libreoffice called from a golang application leaves zombie processes behind
In golang I am using headless libreoffice to convert a docx to pdf in the following way:
cmd := exec.Command("libreoffice", "--headless", "--convert-to", "pdf:...
0
votes
0
answers
55
views
Force end connections in connection pool if request timedout
I am trying to see whats the best practice for configuring go http client. We recently had a load balancer node of a dependency go down and the node was replaced with same ip. However we see that ...
1
vote
1
answer
81
views
Infinite loop while using redis scan command to delete patterns in golang
I am using scan command in golang to get redis keys by a provided pattern. I am using redis cluster, and therefore in order to avoid missing keys I use ForEachMaster. This is the code I use:
func ...
0
votes
1
answer
57
views
cgo C struct field visibility
given the following go code:
/*
#include <netinet/tcp_var.h>
typedef struct tcpstat Tcpstats;
*/
import "C"
type TcpStats C.Tcpstats
then
go tool cgo -godefs
will generate the C....
1
vote
0
answers
29
views
Workarounds for GCP Load Balancer Closing SSE Connections After Timeout Without Increasing Backend Timeout?
I'm hosting a Go service behind a Google Cloud HTTP(S) Load Balancer that serves Server-Sent Events (SSE) to clients as one of their service (there's another service which only serves normal API ...
1
vote
1
answer
40
views
cookie not being set in nextjs frontend with golang backend
Problem:
I have a /login endpoint that sets an HTTP cookie with a refresh token. However, when I call the /refresh endpoint, it can't find the cookie, even though I can see the Set-Cookie header in ...
-3
votes
0
answers
46
views
float point register save problem in golang goroutine preemptive schedule model
I'm learning about the goroutine.
After 1.14, golang supports signal-based preemptive scheduler.
If there are 2 goroutines(g0,g1), both of them are running same code:
for <a-long-time> { x += 0....
0
votes
0
answers
46
views
Producer-Consumer pairing using a single shared channel in golang [closed]
Recently in an interview, I was given a m x n matrix, I will have m producers and consumers. Each producers will read elements from the row in the matrix, one by one, and push it to a common shared ...
-1
votes
0
answers
45
views
go with makefile - working directories are different [duplicate]
I use a makefile to handle go commands
The makefile is always run from the root directory in the go project (which I also want to be the working directory), but the working directory seems to be ...
-1
votes
1
answer
89
views
Go argument concrete type checking [duplicate]
Given the following example
package main
type I interface {
Do()
}
type S struct {}
func (s *S) Do() {}
func Handler(h func (i I) error) {
// ...
}
func Wrapper(i I) func (i I) error {
...
1
vote
1
answer
50
views
Exclude files from Go module that is exposed as a dependency in another package
I've created an SDK that will be used for some different clients. This SDK has a structure similar to this:
- sdk-go
- .github
- config
- test1(folder)
- util
- .gitignore
- go.mod
- ...
0
votes
2
answers
59
views
How to consistently stringify maps when key iteration is not ordered?
I am building a heterogeneous map for an interpreted programming language in Go. As part of the language, I want to be able to stringify any value for printing.
I have the following code:
// ObjKind ...