Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
49 views

Declare pointer to function whose signature is not known

I would like to declare a variable which is a pointer to a function with an unknown signature. For example, to declare a variable which can contain a pointer to a function which can be set to log....
Charlie Skilbeck's user avatar
-3 votes
0 answers
19 views

about go amqp sdk ,Why is the newChannel method working correctly [duplicate]

when i read https://github.com/rabbitmq/amqp091-go source code Why is the newChannel method working correctly? In the recv function, the first parameter is a pointer to a Channel, and the second ...
fuyou001's user avatar
  • 1,636
2 votes
2 answers
76 views

Use reflect to make a new struct from unknown struct type

I have a function that expects to receive an array of pointers to structs of unknown definitions. I want to be able to create a new instance of the unknown struct, assign values to it, and then append ...
Aria Lopez's user avatar
2 votes
0 answers
28 views

LauchDarkly flag value specific for test case

I'm trying to unit test a function that is partly controlled by a LaunchDarkly flag. My wish is for the flag to be set to true for every test case but one. To achieve that I'm trying to set specific ...
Gabe's user avatar
  • 1,338
2 votes
0 answers
43 views

How to generate multiple packages using sqlc and golang

I am working with sqlc in golang. Most of the work has been very good. But now my project is growing a little bit an I am struggling to have some level of organization I am organizing my sqls in ...
TalesMGodois's user avatar
0 votes
1 answer
43 views

Utilizing Sqlite `no such table` error in Go?

When working with the sqlite database in Go. During the testing I got the error: no such table: table_name. Well I know where the error is coming from. But I want to know if there is a way that I can ...
guts_thakur's user avatar
-2 votes
0 answers
38 views

Loops: Execute a specific task on the upcoming iteration, if a condition is met [closed]

Using a for loop, I want to check, if a certain condition is satisfied. Whenever this condition is satisfied, my program must execute a specific task. In addition, during the iteration proceeding the ...
Nico's user avatar
  • 10
1 vote
3 answers
68 views

PDF Signature Appearance is not Visible

I'm implementing visible digital signatures in PDF documents using incremental updates. I'm generating the signature using a PKCS#7 detached signature and adding a widget annotation to represent the ...
vanbroup's user avatar
-3 votes
1 answer
85 views

cpprest http client send request before server is up

I have a server program written in Golang that listens on 127.0.0.1:5555, and another program in C++ that uses cpprest to create a client and send a POST request to 127.0.0.1:5555 upon execution. When ...
user16284772's user avatar
-1 votes
0 answers
52 views

Is this an efficient way to "rotate" the bits in a bitmask? [closed]

I'm doing some coding challenges for myself, and one of them is efficiently handling and processing the shapes and rotations of Tetris pieces. I decided that storing the initial piece configuration ...
LordZardeck's user avatar
  • 8,249
1 vote
0 answers
13 views

Failing to get to run CircleCI with github

I am reading Securing DevOps By Julien Vehent and I am stuck in Chapter 2 Building a barebones DevOps pipeline. I forked and cloned the book's repository % git clone https://github.com/mictadlo/...
user3523406's user avatar
-1 votes
0 answers
61 views

How to properly define GoLang struct for nested arrays [closed]

Here is how my mongoDb document looks like: { "_id": 111, "updateDate": "2000-10-01T04:00:00Z", "updateLogs": [ [ { "updatedBy"...
John Glabb's user avatar
  • 1,589
-4 votes
0 answers
31 views

Under what conditions does #Golang's standard library in math/rand/v2 provide a CS(P)RNG or "True RNG Source" that complies with NIST SP 800-90B? [closed]

Ignoring the Dual_EC_DRBG scandal, assume we want to be compliant with NIST SP 800-90; here is some background on the standards: Random Number Generation: https://en.wikipedia.org/wiki/NIST_SP_800-...
hagemt's user avatar
  • 320
1 vote
0 answers
33 views

Why is running a query with boolean 'group by' not working with gorp's SelectRow, but it's working when I run it directly in a database shell?

Here's the sql fiddle. This is just an example I made up, the real query is not about sales and products, but the structure of the query more or less is the same (but more complicated). The query ...
Farol R's user avatar
  • 11
-4 votes
0 answers
40 views

retrieve username in a service in Mac [closed]

I am trying to retrieve username in max service but I am getting only root as a username in service. How can I get the current users username in Mac. I tried using 'whoami' command and currentUser, ...
vk_'s user avatar
  • 57
0 votes
1 answer
35 views

When using rows.Values() in Go's pgx, How can I know if the value was NULL without resorting to use rows.Scan()?

I want to iterate over the values in a row with rows.Values() and that works but there is no clear way how can I check if each value has NULL (valid/invalid): rows, err := conn.Query(context....
RubenLaguna's user avatar
  • 24.4k
-2 votes
0 answers
11 views

Is the truncation of sarama producer messages caused by concurrency? [closed]

kafka 3.6.1 sarama 1.34.1 go 1.20 The messages recorded by Kafka are occasionally truncated, and occasionally two messages are truncated and merged together, which looks like concurrency. At present, ...
Liang Tian's user avatar
0 votes
0 answers
13 views

jwt.Parse Crashes Under Load in Custom Tyk Plugin

I am using the jwt.Parse function to validate tokens in a custom Tyk plugin. Under high load, the code frequently crashes, causing the gateway to fail. This issue occurs when multiple requests are ...
SmartCoder's user avatar
1 vote
0 answers
21 views

Using GORM models in frontend of Wails app

I'm building a desktop app with Wails which writes to a local SQLite database. I have the following model in my Go backend: type FilmGroup struct { gorm.Model Films []FilmRoll ...
FlameDra's user avatar
  • 2,087
2 votes
1 answer
34 views

How to select in($1) using sqlc and golang?

I have been working in SQLC and Go, I am struggling to find items using in or any my db used ids as Bigserial type, which is being translated as int64 in my table types as you can see in my ...
TalesMGodois's user avatar
1 vote
1 answer
48 views

Add filter to aggregation function in go redis

I'm trying to use go-redis to calculate the sum of the field duration across entries in a redis database. I'm able to sum the entries if I use all the entries, but I want to filter out entries that ...
user1716970's user avatar
3 votes
1 answer
63 views

ERROR: invalid input syntax for type json (SQLSTATE 22P02)

type ComputeConfig struct { DbId DbOwnerAudit DbTimeAudit Name *string `gorm:"column:name" json:"name"` Type ComputeType `gorm:"column:type&...
Kunal Katiyar's user avatar
-1 votes
2 answers
92 views

Is map assignment thread-safe in Go? [duplicate]

I already know that the map operation is not thread-safe. For example if there are several go routine to read and update one same map(as @rustyx refered, just as s := cache["foo"] and cache[&...
Jason Pan's user avatar
  • 780
1 vote
1 answer
36 views

Using a similar model to map with gorm, but gorm preload is wrong

First, I have the Post model, which has been migrated to database type Post struct { ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"` ...
Huy Pc's user avatar
  • 11
0 votes
0 answers
29 views

How to deploy llm model with golang(onnxruntime_go)?

I'm trying to deploy in production a LLM model with onnxruntime_go(https://github.com/yalue/onnxruntime_go). The problem is that I can not get the correctly answer, since I have loaded a tokenizer and ...
Wyatt's user avatar
  • 1,435
1 vote
2 answers
29 views

How do I get the current postgres sql or sqlx schema search path?

I am do ing a search on a post gres table and getting no records returned. The matching records are in the table I am searching. There is another table in aother schema where the data is not in any ...
Donald French's user avatar
-1 votes
1 answer
53 views

Replicating /etc/profile.d under ~/.profile.d by copying the code from /etc/profile and changing the path [closed]

I'm trying to replicate the functionality of /etc/profile.d by copying the segment of /etc/profile that runs the scripts in profile.d in my ~/.profile, and have it run scripts under ~/.profile.d. Here'...
chexo3's user avatar
  • 57
0 votes
1 answer
34 views

Code written in golang, output as a C dynamic library, is called by posgres17, but Golang-generated dynamic library functions is blocked

everyone: I wrote a demo, but it doesn't work properly, can you help me, thank you very much. Code written in golang, output as C dynamic library "libtest1.so", is called by the "...
wgf098's user avatar
  • 9
-3 votes
0 answers
55 views

Why don't simultaneous read/writes to a primitive int pointer panic? [closed]

In trying to intentionally create examples of concurrent RW panics in Go, I was surprised to find it difficult to cause a RW panic on a simple int primitive pointer. For example, the following code ...
Josh Hibschman's user avatar
-1 votes
0 answers
35 views

disable new line at EOF in GO extension in vscode

i have a problem that when i'm editing a big .go file and saving it then formatter is automatically adding a new line at the end of file, which is for some reason causes my cursor to move to somewhere ...
Tentes's user avatar
  • 43
0 votes
2 answers
46 views

Go Fyne Window Crashes with too many logs

I am coding in Go and using Fyne to display a window. I have tasks that log info to this window. When I make the tasks log strings to the window at high volume the window is no longer readable and ...
Ahmed Zaidan's user avatar
1 vote
0 answers
29 views

Managing react-oauth google login and connecting it to backend golang with gin and goth

I'm trying to implement google login in my react frontend using react-oauth and go as backend with gin and goth this it the rendered GoogleLogin in the frontend <GoogleLogin onSuccess={...
Dreynaldis's user avatar
1 vote
0 answers
34 views

Gorm is not using the query I provide. Proper way to query. with GORM

This query: db.Where(&ArchivedImage{DocID: docId}).First(&image) //"doc_id = ?", docId).Find(&image) Which is looking for an archived image and nothing was returned other than a ...
Donald French's user avatar
0 votes
0 answers
31 views

Gorm/PostgreSQL: How to Ensure Connection to Specific Database Instead of Default (solved)

When connecting to PostgreSQL using Gorm in Go, my application is connecting to the default postgres database instead of the specific database I've configured. func (app *Application) ...
Aris's user avatar
  • 9
1 vote
0 answers
63 views

Saving TLS connections after an exec in Go [closed]

I am writing a server that uses long TCP connections (a mixture of plain TCP connections and TLS ones). Occasionally I would need to update the server software, so I replace the program's executable ...
Runxi Yu's user avatar
-1 votes
0 answers
49 views

Is it okay to use a single global http client for multiple requests? [duplicate]

I am working on a microservice that reads messages from a messaging queue and makes some http calls based on the information from the message. Specifically it gets proxyServerId and clientId from the ...
Nikolai's user avatar
  • 31
0 votes
0 answers
31 views

How to make sveltekit SPA app manage routes with golang backend when entering urls in browser

With having backend built in golang, frontend built in sveltekit as an SPA, how to make sveltekit frontend manage routes make in sveltekit, while having golang handle routes for api? For example: i ...
mspehar's user avatar
  • 587
1 vote
1 answer
45 views

Chaining routes using NewServeMux

I'm using Go's standard library and trying to register multiple HTTP handlers with http.NewServeMux. However, I've encountered an issue where only the route /reservation/cancel is registered, while ...
iTchTheRightSpot's user avatar
1 vote
0 answers
55 views

go-coap get current status

I would like to connect to my air purifier (Philips AC3033) via COAP to get current statistics/status. The following go code: package main import ( "context" "log" &...
yellowhat's user avatar
  • 519
1 vote
0 answers
83 views

How to implement dependent dropdown lists in Excel using the excelize Go package?

I'm trying to create an Excel file with dependent dropdown lists using the excelize Go package. I have a file with three sheets: FruitData, VarietyData, and ColorData. On the main sheet (Main), I want ...
Mohanraj M's user avatar
2 votes
1 answer
44 views

Go: Assignment of type aliases for generics [duplicate]

I have type that receives generic After it, i create type alias with filled generic type When i try to assign variable typed with type alias to the same type i receive following error: cannot use y (...
REaDy - K's user avatar
0 votes
2 answers
26 views

Docker multiplatform image [duplicate]

So I'm stuck with this problem. I have - macos arm laptop where I need to build images - Dockerfile: FROM --platform=${BUILDPLATFORM} golang:1.22 AS builder WORKDIR /workspace # args ARG ...
kotyara85's user avatar
  • 325
1 vote
1 answer
27 views

How to convert double to a time.Time value with the mongo Golang driver?

I've got a database with some legacy data where some of the documents store the field "createdDate" as a normal bson date, but others store the field as an epoch millisecond timestamp with ...
takanuva15's user avatar
  • 1,628
1 vote
1 answer
43 views

How can I set Go's log/slog to send to multiple outputs (console, file) and in different formats (TextHandler, JSONHandler)?

When I create a slog instance I need to pass a single slog.Handler to that means that a logger can only write to a single Handler and the handlers that come with slog seem to write to a single output ...
RubenLaguna's user avatar
  • 24.4k
1 vote
1 answer
23 views

Is the CheckSignature method of x509.Certificate safe to be called from multiple go routines?

I am trying to understand if the CheckSignature function from crypto/x509 is safe to be called from multiple go routines at the same time? I tried to look for any comments but couldn't find anything. ...
Nilan Saha's user avatar
2 votes
0 answers
31 views

Using the Go Aurora SDK seems to occasionally connect to read only instance

I'm using GO (in a lambda) to connect to a serverless Aurora DB. I have a read and write instance. When creating the client I do the following: region := "eu-west-2" config, err := config....
Mark's user avatar
  • 374
-3 votes
0 answers
34 views

How to marshal/unmarshal struct with agnostic type (interface) in Go? [duplicate]

I have some struct Settings which has an agnostic field Attrs which is a interface. I have no problem marshaling this with goccy/go-yaml, but I am unsure what the mechanics are to correctly do that?. ...
Gabriel's user avatar
  • 9,404
0 votes
0 answers
27 views

clarification on redis-sentinel read & write

I am trying to write a golang application and its read intensive so I am using redis for caching. I am planning to use redis sentinel and thinking of making write(to redis) through master and read (...
The crazy knight's user avatar
2 votes
2 answers
39 views

Right valkey-go alternative for the redis-go Scan-with-iterator

With go-redis I am using iterator to scan a large number of keys like below scanIterr := client.Scan(0, "*", 1000).Iterator() for scanIterr.Next() { key := scanIterr.Val() fmt.Printf(...
Harish Reddy's user avatar
1 vote
2 answers
51 views

Type mismatch in Go generics with mixed untyped arguments

func sum[T int | float64](a, b T) T { fmt.Println("Type of a: ", reflect.TypeOf(a)) fmt.Println("Type of b: ", reflect.TypeOf(b)) return a + b } type Pair[K, V any] ...
chinna's user avatar
  • 21

1
2 3 4 5
1482