74,392 questions
0votes
1answer
23views
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 ...
-4votes
0answers
36views
Implement git clone --reference /path/to/reference/repo <remote_repository_url> <local_directory> using go-git
How to implement this command using go-git. git clone --reference /path/to/reference/repo <remote_repository_url> <local_directory> I need to implement a feature that caches the code from ...
-3votes
0answers
35views
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....
0votes
0answers
39views
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 ...
-1votes
0answers
40views
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 ...
-1votes
1answer
87views
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 { ...
1vote
1answer
46views
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 - ...
0votes
2answers
56views
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 ...
-1votes
0answers
33views
facing EOF in goose [closed]
I am encountering an EOF error when running the goose up command for database migrations in my Go project. The error message is: goose run: EOF I have attempted to resolve the issue by trying ...
0votes
0answers
41views
Catch IMDS errors with the AWS Go SDK v2 Retryer
I sometimes suffer this error in a context I do not control; CI/CD pipelines that run in another account. <operation>, failed to sign request: failed to retrieve credentials: failed to refresh ...
0votes
0answers
78views
Unexpected modification time of created file
I'm writing a unit test of a component that creates a file, specifically the case where it doesn't set the file's modification time (mtime). I.e., I'm verifying that mtime is within the time range ...
1vote
0answers
17views
Allow multiple plugins operate on matching filters
Goal I want to use multiple plugins to operate on any file that matches their filter. 2 plugins with the same filter should be allowed to process the file that matches the filter, i understand esbuild ...
0votes
0answers
29views
logging Apps-output via a centralized webserver written in golang [closed]
I have the following constellation: Several hundred apps that produce logput. Since access to the local file system of the apps devices is inconvenient, I would prefer a centralized log option. What I ...
0votes
1answer
68views
Unable to call Mock method in golang using testify/mock
I am using stretchr testify for mocks. In actual go code the function MyData() however calls another function MySub() with same struct type. And I want to mock the MySUb() only. So, when I call the ...
0votes
0answers
64views
How to check if HTTP headers have been sent [duplicate]
How to check if HTTP headers have already been sent to the client? If a panic happens I use this function to log the error but also send an error back to the client func Recover(w http.ResponseWriter){...