74,473 questions
Advice
0
votes
2
replies
110
views
How do I make web interactive maps with GO and React?
I am making pet-project with Go and React. I want to make web app, that for start, shows your location on a interactive world map. How should I make app logic with Go and React, so it would be ...
Advice
0
votes
4
replies
128
views
How can I check whether a string contains only digits in Go?
In Python, I can use the str.isdigit() method to check whether a string contains only numeric characters.
For example:
"12345".isdigit() # True
"123a".isdigit() # False
&...
Score of 0
0 answers
37 views
Chromedp initialization fails on warmup with "chrome failed to start" in Windows
package browser
import (
"context"
"log"
"os"
"os/exec"
"time"
"sync"
"path/filepath"
"...
Score of 2
1 answer
87 views
How to convert to a different type depending on architecture?
I am trying to fix the compilation of file overlay/tun_freebsd.go in module github.com/slackhq/nebula on armv7 FreeBSD. This file uses the syscall.Iovec structure, which is defined as
type Iovec ...
Score of -6
0 answers
49 views
Why does Go require package declarations in every file if all files in a directory belong to the same package? [duplicate]
If they already know all files in a directory belong to the same package, why not remove package declarations entirely?
Score of -3
0 answers
48 views
Go SDK "Cannot recognize the token" when calling upsert with a custom function
I'm writing daily k-line data to DolphinDB DFS through the Go SDK. I have a custom function defined on the server side for batch upserting:
def dayKlineUpsertBatch(t, data) {
return t.upsert!(data,...
Score of 0
0 answers
69 views
Electron.js + React + Go (Fiber) build issue: React UI blank screen when backend is bundled, but works when running backend separately
I am building a desktop application using Electron.js with a React frontend and a Go (Fiber) backend.
During development (npm run dev), everything works perfectly. However, I am facing an issue when ...
Score of 1
1 answer
149 views
Goroutines leaking after context cancellation in fan-out/fan-in worker pool
I have a fan-out/fan-in worker pool that's supposed to stop all workers when the context is cancelled, but under heavy load with short timeouts, the goroutine count keeps climbing and never recovers.
...
Advice
0
votes
3
replies
184
views
httpclient and (decorating) middleware in golang
I am trying to grasp (and sofar failing) to exactly grasp how the following code example works. It wraps (decorates) a standard http.client with 2 middleware functions (Logger and BasicAuth) that are ...
Tooling
0
votes
0
replies
105
views
How to watch files in Go with debouncing and glob pattern support?
When using fsnotify directly in Go, saving a single file triggers 4 to 5 raw events per save. For example saving a file in VSCode produces WRITE, CHMOD, WRITE, RENAME and CREATE events all from one ...
Score of 1
1 answer
129 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: ...
Score of -1
1 answer
100 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 ...
Score of 2
1 answer
89 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,
...
Score of -3
1 answer
138 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
144
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) > ...