Category "go"

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

Golang Unmarshal an JSON response, then marshal with Struct field names

So I am hitting an API that returns a JSON response and I am unmarshalling it into a struct like so: package main type ProcessedRecords struct { SLMIndiv

Multiple modules within the same project

I've been playing with Go modules and I was wondering what the best practice is in terms of the following directory structure: project ├── go

How to use "go get" to retrieve modules / packages from a private server

I would like to install/get packages from AWS instance git([email protected]/folder1/folder2/sample.git) to local using "go get" command. Then, this will update i

"PathError" when deploying Go project to AWS Lambda

When deploying this Go-based AWS Lambda project, via AWS console, I receive: { "errorMessage": "fork/exec /var/task/main: exec format error", "errorType": "

Go - check if IP address is in a network

Given: a network address A: (172.17.0.0/16) and an IP address from a host B: (172.17.0.2/16) how can we say if B is in A? All addresses are string variables in

golangci-lint Segmentation Violation error

I am trying to run golangci-lint tool. I think I might have accidentally upgraded my Golang version from 1.17.2 to 1.17.6 recently and somehow broke golangci-li

Debugging Go tests in Visual Studio Code

On my Windows machine, I have Visual Studio Code installed. To run tests manually, I go in console to projects folder and enter go test main_test.go It works

Can't Run Go Bin In Terminal

I have been executing my Golang code on Visual Studio in the terminal for the past few weeks. All of a sudden I am trying to run a program I made, and it does n

Can't Run Go Bin In Terminal

I have been executing my Golang code on Visual Studio in the terminal for the past few weeks. All of a sudden I am trying to run a program I made, and it does n

Unable to run ginkgo bootstrap command on mac

When I run this command ginkgo bootstrap I am getting this error zsh: command not found: ginkgo I have already installed ginkgo using the following command

Golang loop through video frames and pixels?

Is it possible in Golang to loop through an .mp4/.mov video file frame by and modify each frame's pixels? I know this is a complicated answer and there are bet

Issue with connections pool on mysql

I'm having some issues with the api I'm developing: sometimes (yes, not always) when I make a request to the golang server from my angular app, it gaves me this

What's the difference between bufio.NewReader(os.Stdin) and fmt.Scanln() in Golang [closed]

package main import ( "bufio" "fmt" "os" ) func main() { in := bufio.NewReader(os.Stdin) fmt.Println("Please input S: ")

simple planetscale - golang app won't select the database properly

After connecting to a Planetscale database using DSN with the following structure: user:password@tcp(host)/database?tls=true I decided to test it by running a

How to use the go-mysql-driver with ssl on aws with a mysql rds instance

I have a RDS instance running on AWS and I want to know how to connect to that instance over ssl. From this link Using SSL with mysql database. AWS sets up our