74,417 questions
0
votes
0
answers
30
views
Buf can't find google/api/annotations.proto in vendored directory for Cosmos SDK v0.53 module
I'm developing a new module for a Cosmos SDK v0.53 application and I'm completely stuck on a persistent buf error. I have resorted to vendoring all my Protobuf dependencies into a third_party ...
1
vote
1
answer
42
views
How to bind JSON request to a map[string]interface{} in Gin (Golang)?
I'm working on a REST API using the Gin framework in Golang. I want to bind a dynamic JSON body to a map[string]interface{} instead of a struct, so I can accept flexible key-value pairs. Here's a ...
0
votes
0
answers
39
views
golangci-lint forbidgo for `Times(1)` is does not correctly match the function call
forbidigo:
forbid:
- pattern: Times\(1\)
msg: "No need to specify Times(1) for a single call."
The above forbidgo rule, still lets the code below pass! What is going ...
-4
votes
0
answers
58
views
How to find path by given a filename input in CLI
I want to create a CLI tool with cobra cli framework where i have subcommand that take argument filename.
then i can write a content to the file argument is given. but how i suppose to know
where the ...
1
vote
0
answers
27
views
ttsClient.SynthesizeLongAudio undefined (type *"cloud.google.com/go/texttospeech/apiv1".Client has no field or method SynthesizeLongAudio)
Triggering a Cloud Run Function 2nd Generation based on changes to files in a Google Cloud Storage bucket.
go.mod
go 1.24
require (
cloud.google.com/go/storage v1.51.0
cloud.google.com/go/...
0
votes
0
answers
45
views
Unable to Authenticate to Docker image via Golang
I am new to Docker and Golang. I am trying to run Golang server locally and connect it with my postgres docker image.Basically I want the DB to run as docker container with persitant volume
Error
PS C:...
1
vote
1
answer
89
views
Go http.FileServer returns 301 for existing file in tests, but works in browser
I'm building a Go web server that serves static files using TDD.
When I?run my?server?and?access?/static/index.html?in the browser, it works?fine and?returns?the file. However, when I?run my?test ...
2
votes
0
answers
68
views
gopacket how to distinguish between phyiscal and virtual devices
I am using pcap.FindAllDevs() to find all devices then monitor their traffic. However, I only need the physical ones and the library doesnt provide a method to distinguish between physical and virtual ...
0
votes
1
answer
47
views
How do I change the indent of a YAML sequence in goccy/go-yaml?
I have a YAML file which starts out like this:
additional_hostnames: []
I use goccy/go-yaml to parse it and add a new value like this:
newHostnameNode := ast.String(token.New(hostname, hostname, &...
1
vote
1
answer
40
views
runtime.AddCleanup does not run in golang
Due to application-specificity, I am trying to store either an object or a integer into a single int64 using the code below. However, the GC failed to release the resource. I am not sure where it went ...
1
vote
0
answers
77
views
how i can populate struct type only in returning joined column from sql
I have a table named tasks where have relationship one-many to another table (projects), i want to query tasks with projects but only return selected column from the projects table. how i can do that ...
2
votes
2
answers
72
views
set bubbletea program on model
I'm attempting to use the bubbletea library in Go, and one of my models needs to send a message when updated, which requires a reference to the bubbletea Program. I'm running into a chicken and egg ...
-3
votes
0
answers
83
views
Port http server is different but still get response [closed]
I'm currently building a simple reverse proxy where I can forward to the origin server.
When the client requests from the reverse proxy, I do not change the header of the request. The request still ...
-5
votes
0
answers
50
views
Unable to run .go file without admin rights in vs code [closed]
I am new to go and I have written a simple go Lang Hello world code but when I try to run i using command go run hello.go it gives me error.
"The application you are trying to run is not ...
-3
votes
1
answer
105
views
How to cancel long-running tasks when a Go HTTP server is shut down? [duplicate]
I'm writing an HTTP server in Go that performs long-running tasks (e.g. data processing or computation). When the server shuts down via srv.Shutdown(ctx), I want in-progress handlers to stop, even if ...