Category "go"

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

How to alert() in Go to show messagebox

In javascript, if we want to show pop up messagebox with custom message in browser, we can use alert("message") function. How to do it in Go?

Programmatically set an url parameter in gin context for testing purpose

I am writing some test suites for gin middlewares. I found a solution to test them without having to run a full router engine, by creating a gin context like th

Problem installing SSL Certificade in Go Lang with Echo framework (Client sent an HTTP request to an HTTPS server.)

I have build a Go server using Echo framework, i get TLS certificades and a domain name, but when i try a request i get the message "Client sent an HTTP request

Gobuffalo error "There is no connection named development defined!"

In my go project I install gobuffalo: go get github.com/gobuffalo/pop/... And then I run soda migrate but I got this error There is no connection named develop

How to decode a JWT token in Go?

I am currently working on a Go application. I receive a JWT token from the client side and I need to decode that token and obtain the relevant information: user

how to generate X-Amzn-Trace-Id for Golang in the simplest way

I have been seeing this documentation by AWS Is there any simple way to generate "X-Amzn-Trace-Id" with X-Ray? the func NewIDGenerator() doesn't produce the for

Golang TCP server gives "dial tcp 127.0.0.1:9999: connect: connection refused" error

I am learning from the book An Introduction to Programming in Go by Caleb Doxsey In chapter 13 about servers we are given the code: package main import ( "

Get kernel symbol name in Golang

I’m trying to use bpf_get_stackid in the eBPF to query the kernel stack with the flag BPF_F_FAST_STACK_CMP. In the stacks map(BPF_MAP_TYPE_STACK_TRACE typ

Passing an optimization flag to a Go compiler?

To compile a Go program you type go build myprogram.go, can you pass an optimization flags along or the code is always compiled in the same way? I am talking ab

How to mock redis connection in Go

I am using https://github.com/go-redis/redis package to make Redis DB calls. For unit testing I want to mock these calls, is there any mock library or way to do