Skip to main content
0 votes
0 answers
30 views

How can I marshal a struct into JSON where one string field is streamed from an io.Reader containing raw text?

I have a structure like: { Foo int `json:"foo"` BigString io.Reader `json:"bigString"` // I want this to be encoded as a JSON string } And I would like to Marshal this into ...
pamphlet's user avatar
  • 2,074
-2 votes
0 answers
17 views

Visual Studio Code ignores GO ENV when installing tools

I'm working on a fresh install of Go from Homebrew on a M1 Mac. Had some conflicting setups from working with different projects and teams and tried to start over. It's version 1.22.7 of GO - ...
Bmo's user avatar
  • 1,208
-1 votes
0 answers
14 views

How to Perform GET/POST Requests to a Server Using Kerberos Authentication in Go? [closed]

I'm working on a project using Go, and I need to make GET and POST requests to a server that requires Kerberos authentication. I've tried looking into libraries and examples, but I'm still unclear on ...
Denis Korovin's user avatar
0 votes
0 answers
21 views

net.PacketConn ReadFrom, how to distinguish packets

The documentation for net.PacketConn ReadFrom method states that it reads a packet from the connection. If my buffer is smaller than a packet how do I know the packet boundaries? I thought of the case ...
George's user avatar
  • 7,449
0 votes
0 answers
15 views

Is there a way to apply modifiers inside an array in gjson?

The library tidwall/gjson allows me to parse json string and apply modifiers on it (a custom function on the value) but I dont see a way to apply a modifier on a value inside an array of structs. ...
egjlmn1's user avatar
  • 324
0 votes
0 answers
22 views

How to handle Ctrl+C when executing a process using Go Docker SDK?

I have a Docker container running indefinitely with a default command tail -f /dev/null that I created and started using Go Docker SDK: ... config := &container.Config{ Image: "...
Mister D.'s user avatar
  • 679
-3 votes
0 answers
21 views

Should I use member or non-member functions when breaking constructors in Go? [closed]

Suppose I have a big, complex struct Foo. type Foo struct { // a big, complex object... } It will be created with the constructor function NewFoo(). Since the object is big and complex, NewFoo() ...
rodrigocfd's user avatar
  • 7,682
2 votes
0 answers
29 views

How to refresh a token when token expires in a go backend application

In my go backend application I generated a token when my app is initialised.And I want to use this token as a global variable for further authentications. type Token struct { Name string ...
hafis's user avatar
  • 119
1 vote
0 answers
16 views

Firebase FCM push notification is not working on ios for Golang

I'm sending a message like this for Golang to send notifications via all platforms, for _, receiver := range receivers { msg := &messaging.Message { Notification: &messaging....
mimi0007's user avatar
0 votes
0 answers
15 views

CalcDistance Deprecated: How to Calculate Vector Distance in Milvus SDK?

I encountered an error when trying to calculate the distance between two vectors using the CalcDistance(): service unavailable: CalcDistance deprecated. I am using milvus-sdk-go version v2.4.1 and ...
user15860511's user avatar
-3 votes
0 answers
37 views

How to add a caching mechanism to the Abstract Factory pattern in Golang [closed]

How to add a caching mechanism to the abstract factory pattern in Golang I have already written a simple abstract factory pattern, with a general factory and general products. The requirement is to ...
Lillian Gordon's user avatar
0 votes
1 answer
42 views

Go func for running external command, occasionally getting error: file already closed

My function func RunCommand(cmdPath string, cmdArgs string) (error) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() cmd := exec.CommandContext(...
Dinho's user avatar
  • 33
1 vote
0 answers
41 views

why default attribute must also be computed? [closed]

I'm using the terraform plugin framework. Here is a simplified schema: func (t *T) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = return schema....
user219820's user avatar
1 vote
0 answers
28 views

Unable to connect to Postgres StatefulSet in kubernetes cluster from go web server

I have a web server in Golang that connects to Postgres as a StatefulSet. However, I am getting an error with the connection where there is no such host found. The web server was created using ...
helloitsme's user avatar
-2 votes
0 answers
39 views

Why do I need to run `go mod tidy` when I upgrade to Go 1.22? [duplicate]

I recently upgraded from Go 1.18 to Go 1.22. When I try to build now, I get the error go: updates to go.mod needed; to update it: go mod tidy When I run go mod tidy, it makes changes in my go....
Shane Bishop's user avatar
  • 4,574

15 30 50 per page
1
2 3 4 5
4921