74,414 questions
0
votes
0
answers
56
views
What is the correct way to iterate through a JSONL reader with jsonv2
Consider this demo example:
import (
"bytes"
"io"
"log/slog"
"github.com/go-json-experiment/json"
"github.com/go-json-experiment/json/...
0
votes
1
answer
41
views
How do I change the indent of a YAML sequence in goccy/go-yaml?
I have a YAML file which starts out like this:
additional_hostnames: []
I use goccy/go-yaml to parse it and add a new value like this:
newHostnameNode := ast.String(token.New(hostname, hostname, &...
0
votes
0
answers
19
views
runtime.AddCleanup does not run in golang [duplicate]
Due to application-specificity, I am trying to store either an object or a integer into a single int64 using the code below. However, the GC failed to release the resource. I am not sure where it went ...
1
vote
0
answers
64
views
how i can populate struct type only in returning joined column from sql
I have a table named tasks where have relationship one-many to another table (projects), i want to query tasks with projects but only return selected column from the projects table. how i can do that ...
-3
votes
1
answer
90
views
UDP server in Go doesn't receive calls from Lua client [closed]
I have a UDP server set up in go, that reads from any address and then sends a response, and a client that sends the calls to the server. the client sends the calls successfully, but the server doesn'...
2
votes
2
answers
66
views
set bubbletea program on model
I'm attempting to use the bubbletea library in Go, and one of my models needs to send a message when updated, which requires a reference to the bubbletea Program. I'm running into a chicken and egg ...
-3
votes
0
answers
79
views
Port http server is different but still get response [closed]
I'm currently building a simple reverse proxy where I can forward to the origin server.
When the client requests from the reverse proxy, I do not change the header of the request. The request still ...
-5
votes
0
answers
44
views
Unable to run .go file without admin rights in vs code [closed]
I am new to go and I have written a simple go Lang Hello world code but when I try to run i using command go run hello.go it gives me error.
"The application you are trying to run is not ...
0
votes
1
answer
124
views
golang can't find SOME standard library packages (could not import fmt (open : no such file or directory)) [closed]
I'm new to Go and I'm having a strange problem. It has (I think) little to do with the package I want to change, wrap. It has to do with imports.
I'm writing a test program which imports "...
-3
votes
1
answer
95
views
How to cancel long-running tasks when a Go HTTP server is shut down? [duplicate]
I'm writing an HTTP server in Go that performs long-running tasks (e.g. data processing or computation). When the server shuts down via srv.Shutdown(ctx), I want in-progress handlers to stop, even if ...
-3
votes
1
answer
52
views
Generic type constraint match reflect.Type passed [closed]
Could you please help to mercy golang compiler in the following example. I'd like to implement generalized string parser
func Value[T reflect.Type](value string, t reflect.Type) T {
switch t.Kind()...
0
votes
1
answer
55
views
Error 1045 (28000): Access denied for user ''@'localhost' (using password: NO) exit status 1 [closed]
I am trying to implement the tutorial from https://go.dev/doc/tutorial/database-access on windows 11 machine
I have the set variables using the following code in my workspace terminal
set DBUSER=root
...
1
vote
0
answers
68
views
Environment variables not accessible in dynamically loaded .dylib on macOS using Rust libloading, but works on Windows
macOS: The dynamically loaded .dylib cannot read environment variables that were set by the main Rust process at runtime
Windows: The same code works perfectly - the .dll can access environment ...
0
votes
1
answer
105
views
How much stack space is required for saving the function context in Go 1.24?
How much stack space is required for saving the function context in Go 1.24?
I wrote an go demo like this:
func getStackUsage() {
var recurse func(int)
recurse = func(n int) {
tmp := n
...
1
vote
0
answers
42
views
How to enable auto-refresh for VS Code Explorer and Source Control panes for detecting file changes and updates
When the Go extension is enabled in VS Code, updates to local files are no longer displayed/detected in the Explorer and Source Control panes until manually refreshed.
Notes:
Disabling the Go ...