74,477 questions
-2
votes
1
answer
102
views
Goroutine not updating map correctly in concurrent Go program
I’m trying to update a map from multiple goroutines, but the results seem inconsistent. Sometimes keys are missing or values are wrong.
Here’s my code:
package main
import (
"fmt"
&...
0
votes
1
answer
111
views
How can I have a tools-only folder/module?
My project has the following folder structure:
.
├── mkdotenv
│ ├── core
│ │ ├── dotenv_resolve.go
│ │ └── dotenv_resolve_test.go
│ ├── files
│ │ └── files.go
│ ├── go.mod
│ ├── go....
0
votes
0
answers
91
views
Druid Timestamp formatting issue — data correct, but still shows UTC (Z)
I have a Druid SQL query that returns data correctly for different timezones (UTC, EST), but the timestamp format is still shown in UTC (Z), even though the values are correct.
timestamp ...
3
votes
2
answers
149
views
MongoDB Go driver’s topology view is stale and reports no primary indefinitely
I'm encountering an issue in a Go application that uses the official MongoDB Go driver. We have the use case where a ReplicaSet is recreated from scratch. Replica Set consists of 2 members, no arbiter ...
0
votes
0
answers
63
views
Install Wails v2 on mac permission denied
I have an issue trying to install WAILS https://wails.io/docs/gettingstarted/installation
I am running a command and it outputs permission denied.
go install github.com/wailsapp/wails/v2/cmd/wails@...
1
vote
1
answer
70
views
How to set min window size for application
I just want to create a simple chat app. I try setting the min size for myWindow but only found SetMinSize function on baseObject, not for container or layout. Right now my app can shrink very small ...
1
vote
0
answers
46
views
how to manage the lifecycle of a gdk.Pixbuf?
I am dipping my feet into gtk/gdk and golang. I have wirtten a Program creating an image per second by providing a new pixmap to the Image widget via
var theImage *gtk.Image
var nextFrame *gdk.Pixbuf
....
1
vote
0
answers
47
views
Force Self-Closing XML tags for xml.MarshalIndent in Golang [duplicate]
when I call xml.MarshalIndent() in Golang, it produces XML structures like these:
<Screen id="Screen1">
<Label id="Label1" Text="First number: "></Label&...
1
vote
1
answer
224
views
How to cache downloaded go dependencies in a containerized custom script execution?
One of my build steps is a custom script:
bash test/test.sh
The script itself sits in the source code and launches the testing:
cd test && go test github.com/geniot/blaze-test/src -json
I ...
-1
votes
2
answers
92
views
How to use gorazor and iterate over a slice
I want to use gorazor a viewengine written in go that uses razor-Syntax. They provide an example which i tried to understand and adapt.
What is working
I want to iterate over a slices of movies and ...
1
vote
1
answer
55
views
How to get second relation data from the model in gorm
i am new to go-lang and i have been using gin, gorm and postgres for backend api and i want to get the data from the model.
user model:
package models
import "gorm.io/gorm"
// enum role
...
1
vote
1
answer
80
views
Okta Go Api GetApplication using VSCode
I am attempting to instantiate a client, based on the sample https://github.com/okta/okta-sdk-golang?tab=readme-ov-file#get-an-application. No matter what I do I always get:
a 401 Unauthorized Error.
...
2
votes
1
answer
123
views
json string to uint64 convert workaround
I'm currently trying to use json.Unmarshal to convert a json response from server into a type struct.
Part of my type struct uses a type from a library (https://pkg.go.dev/github.com/clarkzjw/starlink-...
3
votes
0
answers
122
views
Bind form data into nested slice with Gin-Gonic
I'm trying to send a post request with form data and bind it to a nested slice.
Here's a minimal example:
type House struct {
Rooms []Room `form:"rooms"`
}
type Room struct {
...
1
vote
0
answers
65
views
Custom Trust Store and Certificate Validation in a Flutter iOS Application Accessing the Microsoft Outlook Portal using a Self-Signed Certificate
I built an MITM Go proxy to intercept all requests. I’m also developing an enterprise Flutter iOS app that uses a custom in-app trust store (so it doesn’t rely on the OS trust store) and I’ve stored ...
0
votes
0
answers
59
views
Windows API for making an app autostart after the login
I have built a app and i want it to auto start after loging in Windows
I have tried puting a symbolic link in the windows startup folder but app dosen't autostart.
I also have tried using Windows ...
-4
votes
1
answer
121
views
A global sync.Mutex don't work with multiple client packages?
I have a package "tools" that expose a method that must execute some logic only one time. The next calls don't do nothing.
The file tools/tools.go is like:
package tools
import (
"...
1
vote
1
answer
62
views
What is the better way to use fyne dialogs synchronously in Go?
I am programming a little software in Go called GoFileEncoder. For the file dialog boxes, I would like to use fyne.io/fyne/v2/dialog. Only, the functions dialog.ShowFileOpen() and dialog.ShowFileSave()...
1
vote
1
answer
115
views
Fyne: dynamically added widgets disappear after hiding/unhiding a custom widget
I created a custom widget in Fyne that dynamically adds other widgets.
Everything works fine — until I hide the parent widget and show it again after a few minutes.
When I call .Show() again, all the ...
-4
votes
1
answer
120
views
golang http.Get() only returning a portion of html body
CONTEXT: My goal is to use http.Get(), then use the golang.org/x/net/html package to parse the resp.Body and extract some bits of data from some <div>'s that all use a similar naming scheme for ...
2
votes
2
answers
120
views
Trying to build golang package ending up with GCC compilation segfault on as --gdwarf-5
After some package upgrade on my Ubuntu 24.04 I stumbled upon inability to build/install/work with almost any of golang packages.
So, I'm trying to install staticcheck and get the following error:
$ ...
0
votes
0
answers
53
views
How to get the location of a cross tenant Azure customer managed key?
I have a Go application the creates a disk encryption set in tenant A, on Azure. It uses an Azure CMK created by the customer in tenant B.
I need to know the location of the key. I only have access ...
0
votes
1
answer
97
views
Creating generic of type where the type uses pointer receiver
I want to create a generic cache, where entries in the cache have some common metadata properties.
// some metadata
type CacheMeta struct {
SomeMutableValue string
}
// we want to mutate the ...
3
votes
1
answer
79
views
Can't read ICMP packets in golang from Windows
I am trying to build my own traceroute for education and fun. I am using go programming language for that.
My problem is when I am using Windows, reading ICMP packages fails even though I see them on ...
-3
votes
1
answer
97
views
how to change parent cmd windows directory in go
I have a cli app written in go and when it closes I want the directory to move to the selected one. When I close I wasn't able to find any way for that to happen so I tried making a .bat wrapper for ...
5
votes
2
answers
2k
views
go: no such tool "covdata" in Go 1.25
After upgrading to Go 1.25 (specifically 1.25.1) when I run go test -cover I get this message:
go: no such tool "covdata"
The command exits with status 1.
It seems this does not happen ...
0
votes
1
answer
51
views
DownloadWithContext retrive incomplete file
I have a problem with using S3 API and Go.
To read an object and immediately transfer it to Minio i use Pipes:
pr, pw := io.Pipe()
For example, I will create an archive object using pipe:
zipWriter :=...
0
votes
1
answer
118
views
How to check if a http server has started in Go tests without using time.Sleep?
I am writing an e2e test which starts the binary of the program and sends an http.Get() request to the server endpoint.
main.go
func main() {
handler := http.HandlerFunc(func(w http.ResponseWriter,...
2
votes
0
answers
54
views
optional query parameter in http signature of proto rpc is not mapped as expected
I was under the impression that given an rpc like below
rpc FetchResource(GetResourceRequest) returns (ResourceResponse) {
option (google.api.http) = {get: "/v1/resource/{resource_id}/group&...
1
vote
1
answer
85
views
Having trouble with Go Templates - wanting to display base/index.html layout across all pages
I've setup my handlers with little to no issue.
At the moment I've got an index.html page - which I've defined as "index", and I've got a login.html page - which is just a dummy form.
I ...
-2
votes
2
answers
95
views
PostgreSql Database Design [closed]
While designing social media application, i want my my users to have unique email and unique username, but the problem is, I am providing an otp verification and my table have coulmn id int primary ...
0
votes
1
answer
66
views
gorilla/csrf in my Go API not sending headers to my Nuxt frontend after signup using OAuth, err: Invalid origin
Firstly, the OAuth flow, itself, works. After sign / login I create a session using gorilla/sessions and set the session cookie.
Now, since I use cookies as the auth mechanism, I thought it followed ...
1
vote
1
answer
83
views
How can I configure editors to follow Go's conventions for indentation with tabs & alignment with spaces?
I've read that Go uses
tabs for indentation
spaces for alignment
and this sounds like a great idea to resolve the tabs-versus-spaces fight and get the benefits that tabs promise without the problems ...
1
vote
1
answer
83
views
gin-contrib/sessions creating new session for every request
I'm trying to use gin-contrib/sessions but every time I make a request to the server a new session is created. It is never finding a previously created session and I can't access any data that should ...
1
vote
1
answer
71
views
Nil golang ssh session for valid address
I'm trying to connect through ssh to a hacking CTF server. I can do it with ssh so can I with python pwn tools but I struggle to do it with go. When I try to create a session, my code complains with ...
1
vote
2
answers
123
views
correct cleanup of spawned child processes in golang
I am working on a project in go (which I am not very familiar with), that runs as a systemd process and spawns child processes, but whenever the systemd service is restarted, I see warnings (sometimes ...
1
vote
1
answer
84
views
How to integrate Golang as VSCode Extension backend
I want to make a VSCode Extension that matchs regex pattern that I define with project's git-logs. I want the best performance, so I am thinking of using Golang as the backend instead of Typescript.
I ...
2
votes
2
answers
158
views
How to scale a font when using image/font.Drawer into an image?
I'm writing text into an image and I want this text to be scaled up (like doubled or tripled).
import (
"golang.org/x/image/font"
"golang.org/x/image/font/basicfont"...
0
votes
1
answer
89
views
Why does Golang's Scanln skip a character in certain cases [duplicate]
for{
var name string
fmt.Scanln(&name)
fmt.Println(name)
}
When you input "abc 123", you will receive outputs for "abc" and "23" respectively(The first ...
0
votes
1
answer
63
views
How to generate distinct_id from Mixpanel GO SDK?
Mixpanel Support is telling me to set the $device_id and $user_id, and let the go SDK decide on the $distinct_id, but all the Mixpanel-Go APIs in the library expect me to provide the distinct_id. So ...
1
vote
1
answer
194
views
In golang slog, how can I add attributes to every log where the value is dynamically calculated?
In principle I want to use slog to produce JSON that contains some specific JSON fields (severity,message, and timestamp). I know I can use ReplaceAttr in HandlerOptions to modify the existing log ...
1
vote
2
answers
3k
views
missing LC_UUID load command Error when running go run on macOS 26 (Tahoe)
When running the go run command (both on GoLand and on the CLI), the error:
dyld[60166]: missing LC_UUID load command in /private/var/folders/some/tmp/dir/
was showing up.
This was happening with Go ...
-4
votes
1
answer
102
views
'go run' triggers Windows Defender
When I run a GO program, temporary files are detected as a threat by Windows Defender.
Example:AppData\Local\Temp\go-link-4058383063\a.out
I have changed GOTMPDIR env var and I disabled security on ...
2
votes
1
answer
179
views
How to pass an array in sqlc to a database query with an "IN" operator
I have been struggling with passing an array/slice from Golang to a sqlc (postgres) database query WHERE clause that has an IN operator. There is very little documentation around this function and it ...
-3
votes
1
answer
113
views
Go routine is not blocking on unbuffered channel consumer [closed]
I created a single producer go routine which emits a value at random interval in an infinite for-loop, similar to this:
func producer() <-chan uint64 {
out := make(chan uint64)
go func() {
...
1
vote
1
answer
115
views
Creating Postgres Users and Granting Permissions from Go
I'm trying to create database users in my Postgres database from Golang, and I can't seem to get queries to run.
I'm able to establish a connection, but I cannot run create user X with password Y and ...
2
votes
3
answers
225
views
Compare integer with byteslice
I have a process that computes and checks the checksum in AIS messages, the checksum is the xor of all the bytes in the message expressed in hexadecimal format. At the moment I am turning both the ...
1
vote
0
answers
36
views
Kafka: Manual partition assignment, controlling consumer members in single conusmer group [duplicate]
So basically I am trying to read data from kafka and dump it to some destination. Before committing the message to kafka, I commit it towards destination and after successful commit to destination, ...
1
vote
1
answer
59
views
Is it possible to override a query parameter in Pact provider tests?
I have Pact tests for a Go service. One of the consumer pact scenarios sends a GET request with a query parameter uuidToken.
The problem is that uuidToken in the database is an immutable field: it’s ...
0
votes
1
answer
48
views
QuickCheck generator fails for structs like time.Time
How to get quick check to generate structs like time.Time?
I'm unable to find any information to help me online, it feels like I'm the only one still using testing/quick
func Test_QuickCheck_Time(t *...