74,489 questions
0
votes
1
answer
17
views
Why do my goroutines see stale or repeated keys when ranging over a map and modifying it at the same time?
I’m experimenting with Go’s for range loop and goroutines, and I ran into behavior I can’t explain.
This example prints inconsistent or duplicated values:
package main
import (
"fmt"
...
1
vote
0
answers
39
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. ...
Tooling
0
votes
2
replies
24
views
lazyvim, golang with goimports: is it possible to use a local config for goimports?
I am working on a module called automat.
When I save my go file, it's being reformatted from:
package cmd
import (
"context"
"fmt"
"os"
"strings"
&...
Best practices
2
votes
4
replies
58
views
Formatting time based on system locale in Go
I want to show the user a timestamp based on their preference, i.e. the system locale. I want to format the time depending on if they're using a time locale that normally shows a 12-hour time, or 24-...
-2
votes
0
answers
34
views
How do I preview a Pdf fike via a presigned S3 URL in React? [duplicate]
I have an api which is responsible for download the file of any mime type if its available in the s3 bucket now in the response it draws a presigned url, hmacsignature, urlbucket name, etc.
Now I want ...
0
votes
2
answers
87
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 ...
0
votes
0
answers
28
views
RPC commiunications in Mattermsot plugins and Apache-APISIX plugins, Is RPC only for Golang - Golang?
I’m trying to understand how plugin systems differ between Mattermost and Apache APISIX, specifically in how they use RPC for external plugins.
Mattermost plugins must be written in Go. The server ...
1
vote
0
answers
69
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
0
answers
30
views
How to correctly establish connection with active directory via LDAP in Golang
I have been trying to write a daemon in go to run on linux that would periodically do certain actions, and once some conditions are met, it would connect to AD, and write a value to a given record.
...
Best practices
0
votes
7
replies
104
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 ...
Best practices
1
vote
2
replies
57
views
How to write idiomatic Go business logic for CRUD involving multiple tables/models?
I am refactoring my backend where clients can start threads and make replies. I keep a 3-layer architecture with thin handlers that bind and validate, service layer with all business logic, and a repo ...
1
vote
0
answers
46
views
Evaluate Kubernetes CEL Condition locally using Golang
I am creating a Kubernetes controller that needs to modify resources when specific conditions are met. I would like to define my match conditions using CEL expressions in a configuration file similar ...
Best practices
1
vote
7
replies
117
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 ...
-1
votes
0
answers
89
views
Exported identifiers in Go [duplicate]
The Go spec states: "An identifier may be exported to permit access to it from another package. An identifier is exported if both: 1. ... 2. the identifier is declared in the package block or it ...
Best practices
0
votes
3
replies
71
views
Representing 4 types of Card Templates Adhering to DDD
I have an Entity Called CardTemplate. For physical cards, there will have to be a pattern chosen to physically print the card. And based on the two types of operations that the cards are allowed to do,...