37 questions from the last 30 days
18
votes
2
answers
2k
views
Invalid settings: setting option "vulncheck": invalid option "Prompt" for enum
the default option of go.diagnostic.vulncheck
it's warning "Invalid settings: setting option "vulncheck": invalid option "Prompt" for enum".
haven't find any other ...
Tooling
1
vote
7
replies
144
views
What is the idiomatic way to organize shared helper functions in Go projects?
In JavaScript projects it's common to keep shared helpers in `helpers/`, `utils/` or `common/` (logging, filesystem helpers, string helpers, etc.). In Go I’ve noticed different conventions.
What is ...
Best practices
1
vote
7
replies
128
views
Reading all available values from channel in Go
If you want to read all values from a channel ch until it is closed, you can do so with range:
for x := range ch {
// do something with x
}
This will block until ch is closed. I want to read all ...
Best practices
0
votes
7
replies
130
views
Cancel context after n other contexts got cancelled
I want to create a ctx for a task required by multiple other contexts. It should get cancelled when all of those contexts got cancelled.
My first approach was this, where the AfterFunc of the last ...
1
vote
1
answer
112
views
go exec.Command is not finding "source" command in my $PATH variable
I am beginner in go and i want to make a virtual environment for python using it.the .venv folder creates with no error but it can't be activated.Here is my code
package main
import (
"fmt&...
Best practices
0
votes
5
replies
97
views
Best practices for architecting a Go CLI with ~100 commands and many flags, how to organize commands/flags?
I'm designing a CLI tool in Go that will expose roughly 100 commands. Each command has its own set of flags, and there are also several global flags. My main goals are maintainability, testability, ...
3
votes
1
answer
98
views
How to chunk code at semantic boundaries when a single AST node exceeds the chunk size limit?
I'm building a code indexing tool for LLMs using tree-sitter in Go. The goal is to split source files into chunks (~600 lines) that respect function/class boundaries for better LLM context.
When a ...
Tooling
2
votes
3
replies
81
views
Go server and godot P2P connection with out port forwarding
This days me and my friend made a multiplayer game in godot. The server is written in go using protobaf. To test the multiplayer, i used ngrok. I know we can use port forwarding but i thought ngrok is ...
1
vote
0
answers
112
views
go telnet send string
I need to send commands by telnet to a matrix switcher from Atlona (though, I suppose, it's not a problem with a device, but anyway).
One of commands is x4AVx5.
When I send it from terminal, it works. ...
-1
votes
2
answers
122
views
Why does my Go templates always render the last child template when using template inheritance?
I'm having an issue using template inheritance in Go. All of my routes are rendering the same file from my templates folder, which happens to be the last one (ViewGames.html). Here is what my ...
Best practices
0
votes
2
replies
95
views
How to verify webhook signatures from multiple providers (Stripe, GitHub, Shopify, etc.) in Go?
I'm building a webhook handler that needs to accept webhooks from multiple providers (Stripe, GitHub, Shopify, Twilio, etc.). Each provider uses different signature verification methods:
- Stripe: ...
1
vote
1
answer
119
views
I can't query by UUID
I'm having trouble querying UUID values stored as BLOB(16) in SQLite3 using Go (with goqu). I insert a UUID using uuid.New().MarshalBinary() and this works correctly. However, when I try to select the ...
1
vote
1
answer
69
views
golang issue when parsing data to bson for mongodb
I am having a strange (to me) an issue with golang mongodb connector. The current problem is that I have a db retrieval function that actually returns no errors, but the struct expected is just not ...
1
vote
0
answers
80
views
How to organize message compression before publishing and decompression when reading on the consumer in the NATS message broker
colleagues!
- I use the "nats" message broker in my Golang project.
- Currently, when using "NATS," large messages aren't compressed at all, causing the producer to crash with an ...
1
vote
1
answer
72
views
Accessing postgres db using pgxpool in a goroutine
I have created a function to return the db connection of a postgresdb using pgxpool. But I don't want to create multiple pools since i will be calling this function each time to execute a query.
Since ...