Category "go"

Go ReadString issues: The filename, directory name, or volume label syntax is incorrect

can anyone figure this out? I think the problem might be in the readstring() argument when being passed to the create file function. I tried resolving it by str

Golang: Unzip files in Go gets char encoding problems in the files names when file has been zipped in windows

I´m trying to unzip files in Go (Golang) using the zip lib. The problem is that when the zip file has been zipped in windows all special characters get me

not compatible with reflect.StructTag.Get

I was working in Google CLoud and all was fine.. but when I clone all my project in my PC, I have this messages in every JSON struct. struct field tag bson:"ed

Golang 'exec.Command' treat single quote parameter special?

I am refer to the post How to execute system command with unknown arguments? to run a jq command on my ubuntu shell. Below is the code I tried import ( "fmt

Signed URL result with random AuthenticationRequired

I have a CDN in gcloud configured with a storage bucket backend, the bucket is private and I give the ObjectViewer permission to the CDN service account (servic

Watch CustomResourceDefinitions (CRD) with client-go

I have added a new CRD ApiGateway to Kubernetes and I want to watch for new/changed resources of it. This works with a simple Rest Client as shown in the examp

wildcard certificate support using Autocert (golang)

implementing a https go server with wildcard certificate support. package main import ( "crypto/tls" "log" "net/http" "golang.org/x/crypto/acme

How to learn internals of the Go Programming Language? [closed]

Recently I've participated several Go job interviews. The first one asked me How is channel implemented?, then the second one asked How is gor

Hugo, how to localized .groupByDate

In my template I sort by months my post like this: {{ range (where site.RegularPages "Type" "in" site.Params.mainSections).GroupByDate "January, 2006" -}} <

Import "google/api/annotations.proto" was not found or had errors. How do I add it as a dependency?

Following the docs on how to set up a gRPC gateway, I find myself stuck at step four of generating the grpc gateway. Namely, things fall apart when the followin

How to use $arrayElemAt with MongoDb

I have the following pipeline, which I want to use it in Golang and convert it to bson.M. One way is using bson.UnmarshalExtJSON but I want to know what is exac

in tests mux.Vars() returns nil instead of expected map

I have a Gorilla Mux router setup inside a function that returns *mux.Router, goes like this func MakeApp(services service.Service, pe PolicyEnforce) *mux.Route

Convert interface to struct

type SipField interface { Info() (id, name, defaultValue string, length int) } type Field string func (f *Field) Get() string { return string(*f) } f

Convert interface to struct

type SipField interface { Info() (id, name, defaultValue string, length int) } type Field string func (f *Field) Get() string { return string(*f) } f

in tests mux.Vars() returns nil instead of expected map

I have a Gorilla Mux router setup inside a function that returns *mux.Router, goes like this func MakeApp(services service.Service, pe PolicyEnforce) *mux.Route

Mutex does not seem to be locking properly

I am just learning about mutexess. I thought the following program would return a total of 1000, but I am getting varied results, so I assume I am doing someth

How do I pass a Go callback (function ptr) from Go to Rust via CGo?

I have: A Rust library that is compiled to a static C library A Go program that calls the Rust library's API via CGo I wish to pass a Go function (as callback)

In Go, is there similar feature like "f-string" in Python? [duplicate]

In Go, is there a similar feature like "f-string" in Python? I cannot find a simple solution like f-string. #Python name = 'AlphaGo' print(f'

How to update metric values in prometheus exporter (golang)

I'm starting to write an own prometheus exporter using golang. I think I got the basics but I don't know what to do exactly to get the value of the metric up to

VScode show me the error after I install the proxy in vscode

gopls requires a module at the root of your workspace. You can work with multiple modules by opening each one as a workspace folder. Improvements to this workfl