74,501 questions
0
votes
0
answers
34
views
crypto/fips140: Documentation request for FIPS 140-3 approved algorithm parameters [closed]
I’m looking for documentation that lists the specific FIPS 140-3 approved parameters for each algorithm in the Go Cryptographic Module (v1.0.0, CAVP A6650).
Specifically, parameters such as:
AES: ...
Advice
0
votes
3
replies
23
views
Brute force vs optimal approach to find the second largest number in a slice (Go)
I’m looking to understand both:
A brute force solution
An optimal solution (in terms of time and space complexity)
The input is a slice of integers, for example:
nums := []int{10, 5, 20, 8, 15}
...
0
votes
1
answer
103
views
How to compare two structs in golang but ignore undefined fields
I want to compare 2 structs in golang and consider them equal if all fields with a value are equal while ignoring fields which are undefined in either struct.
Take the following example:
type MyType ...
0
votes
0
answers
66
views
Gorm order by with params
Is there a secure/blessed/correct way to pass params into a golang Gorm SQL query ORDER BY clause?
This is what I want to do:
tx.Order(`array_position(?, id)`, modelIDs)
The modelID slice is sorted ...
0
votes
1
answer
49
views
AWS Glue Connection for BigQuery gives "SparkProperties is missing but it is required" and "secretId is not defined in the schema" when using Go SDK
I'm trying to programmatically create a native Google BigQuery connection in AWS Glue using the AWS SDK for Go v2 (github.com/aws/aws-sdk-go-v2/service/glue).
According to the AWS docs (Glue 4.0+ ...
1
vote
0
answers
31
views
SQS client not working when base endpoint is provided
When supplying base endpoint in aws config for sqs-client it is fails to get attributes or messages with 400 status code.
cfg, err := config.LoadDefaultConfig(context.TODO(),
config.WithRegion(...
-1
votes
1
answer
73
views
Why does Go's net/http duplicate data into PostForm, Form, and MultipartForm? Isn't this a massive memory waste? [closed]
I am analyzing Go's HTTP request handling, specifically how ParseMultipartForm works. I noticed that when I parse a multipart form, Go populates the exact same data into three separate fields in the ...
Advice
1
vote
2
replies
73
views
Should a Golang module name follow the name of its GitHub repository?
I am making a Go package. It is located, on GitHub, at https://github.com/eliotttak/go-ansi-colors. I would want that the Go module name would be github.com/eliotttak/ansicolors, because the go part ...
0
votes
0
answers
40
views
Run go (golang) templ from VSCode task
I want to add Go Templ command as a VSCode task, so I can run it with a hotkey
I added .vscode/tasks.json to my project's folder that looks like this:
{
"version": "2.0.0",
...
-3
votes
0
answers
89
views
How can I make the custom type (Decimal struct that wraps math/big.Int) display correctly in VSCode or Delve debugger?
I have a custom type defined as follows:
// Package link: https://github.com/shopspring/decimal
//
type Decimal struct {
inner decimal.Decimal
}
decimal.Decimal wraps math/big.Int internally.
...
1
vote
1
answer
51
views
Adding new Flag to urfave CLI Tool Breaks Existing Flag
I am building a CLI tool for docker compose to selectively exclude some containers from running/stopping operations (from a docker-compose.yaml having many containers, user can specify the containers ...
-2
votes
0
answers
74
views
Condition contains in nginx.tmpl [closed]
I am trying to create a custom conditional using the contains function, as shown in this code.
### begin ssl_certificate
{{ if (contains "health.co.id" $cert) }}
ssl_certificate /etc/...
-4
votes
1
answer
146
views
"Undefined function g" when role created via enforcer's API
Using casbin RBAC in Go, if I created a new role via enforcer's API, without LoadPolicy() by hand, later when I access some API, will get error:
Undefined function g
I must call LoadPolicy() by hand,...
0
votes
0
answers
141
views
How can http.Server be made to hold open a connection?
I'd like to add a unit test for Go's http.Server.Shutdown() timing out, but there are no connections held open when the shutdown signal is sent, so it never gets to checking for timeouts, even though ...
-1
votes
1
answer
102
views
How to correctly pass dynamically built command arguments to exec.Command in Go?
I am building a CLI tool for docker compose to selectively exclude some containers from running/stopping operations (from a docker-compose.yaml having many containers, user can specify the containers ...