Category "go"

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

sam local start-api go lambda returns 502 "internal server error" on linux ubuntu

While running aws sam application locally returns "Internal server error". I created aws sam hello-world example using:sam init --runtime go1.x --name robertsa

Golang go get failed with git ls-remote -q using the wrong url @ Go 1.13

Ok according to https://github.com/golang/go/issues/34094, go 1.13.3 fixed this problem Env: Go 1.13, Windows I got a fresh copy of Go on a Windows machine an

'No write concern mode named 'majority`' found in replica set configuration' error

I'm trying to insert an object into mongodb via a POST request. The object that I send gets inserted in the db successfully, however I get the error mentioned a

How to iterate over a union of slices passed in a generic function? (T has no core type)

I am testing out generics in go 1.18 and took a look at this example. I would like to recreate that example but instead be able to pass in a slice of int or sli

Flutter web app does not work with local golang http server

I know it sounds like a beginner's question, but here I go: I've developed a small app to be used locally in restaurants for the waiters to be able to take orde

Go with Generics: type *T is pointer to type parameter, not type parameter

Probably a golang beginner's question :) I'm facing following compiler error when trying to compile the code below. I want to implement an object store for diff

Choosing Golang docker base image

Size of the images golang and alpine vary by around 300Mb. What are the advantages of using golang image instead of plain alpine?

"flag provided but not defined" error in Go test despite the flag being defined in init()?

This question is similar to go test flag: flag provided but not defined, but since that question does not contain a minimal example and the answer is quite high

Error: I/flutter (15548): null on terminal

I'm currently doing this tutorial from YouTube : https://www.youtube.com/watch?v=-Sol_RMG_fo&ab_channel=dbestech in the tutorial, I can't get the data from