74,473 questions
2
votes
1
answer
75
views
Error when running a .exe Go program if I add a line break in the import
I'm running into a strange error when running the .exe that I built from a simple Go script I'm making, when I try to run the .exe it gives the following error and deletes the .exe file:
Translation: ...
-1
votes
1
answer
78
views
Compile code from executed command in code
I'm developing a hacking system that involves compiling hacking scripts to be injected in a CTF server. My goal is to compile each script from executing go build from Go code because the CTF server ...
2
votes
1
answer
66
views
Gotk4 NewMessageDialog doesn't take the message_format argument
I use github.com/diamondburned/gotk4/pkg/gtk/v4. I'd like to create a modal dialog, like this:
dialog := gtk.NewMessageDialog(
&window.Window,
gtk.DialogModal|gtk.DialogDestroyWithParent,
...
-3
votes
1
answer
109
views
The correct way to save the first error of multiple goroutines using a mutex
I'm writing a function that gets student grades in parallel goroutines and returns their arithmetic mean at the end. If at least one student has an error, the function should return the first error ...
Advice
0
votes
6
replies
117
views
golang error handling code example clarification
I am reading up about wrapping and unwrapping errors when doing a chain of calls. On this topic I came up the following snippet of code.
err := controller()
stack := []error{err}
for len(stack) > ...
2
votes
0
answers
70
views
JSONPath to target root based on conditional
My goal is to apply an Overlay to an Openapi Document.
The Overlay Specification exemplifies the usage of "traits".
E.g.: given the following document:
openapi: 3.1.0
info:
title: API with ...
Advice
0
votes
2
replies
58
views
golang implementation of phpserialize in grahamgreen contains a bug
The following test fails on golang , because the library
"github.com/grahamgreen/phpserialize"
wrongly escapes single quote characters.
The working library which does not produce an error ...
Advice
0
votes
1
replies
112
views
I want to sell/forward unused inventory/request from the publisher for a admanager
Can anyone give me any idea how to implement this system inside a adnetwork !
I have the implementation for DSP with open RTB 2.5.
But now I want to redirect my unused inventory/request to other SSPs. ...
1
vote
0
answers
89
views
How to access a Go library (Pdfcpu) in Elixir using Wasmex?
I have an Elixir module in which I am trying to call out to Pdfcpu to modify existing PDFs. Pdfcpu is written in Go and has a CLI and an API, and I am trying to use the API. I am using Wasmex to run ...
Tooling
0
votes
0
replies
124
views
Key-Value to store different types of values
So, I am implementing a Block Storage Engine in Go and go stuck at the Database part to store Manifest (file) information and an Index Table (a map to store each block information). I was thinking of ...
1
vote
1
answer
164
views
How to make generics work with interfaces and pointer receivers
I'm trying to use a generic function to make a value, conforming to a specified interface. It won't compile because one of the methods takes a pointer receiver.
Code:
package main
// implyType is one ...
Best practices
0
votes
2
replies
169
views
What is the best way to the sync.Once.Do() in Go?
I am coding a server in GoLang that allows multiple clients to connect to it and each time a client sends a message to the server that message is propagated to all of the other clients. I came up with ...
1
vote
0
answers
80
views
Golang x509.VerifyOptions CertificatePolicies are not validated during certificate verification?
In Go 1.24.0 there is an additional parameter in x509.VerifyOptions to be included when verifying X.509 certificate. The problem is that if my X.509 ceritificate doesn't contain any policies or ...
Best practices
0
votes
3
replies
87
views
Go generics where value is comparable and pointer-to-value has methods
I have a generic struct that requires passing a generic type that fulfills the constraints where the value is comparable so I can use it in a map index, and the value implements Scanner, ie. type ...
Tooling
0
votes
3
replies
147
views
How do I delete a slice element
I'm in the process of learning Golang, and I'm currently trying to create a Todo project.
My knowledge is limited to the GO base.
Please take a look at my code and tell me how I can delete a task.
The ...
