Category "go"

gomod, Which folders/files will be excluded?

Golang use gomod, Some floder/files will be excluded. Such as example/include floder and *_test.go type file. So, What are all the rules?

consul health check (All service checks failing)

I have read the similar question related to this problem. It ended up with frustration. I installed consul with docker. I run the following command. docker run

SharedInformerFactoryWithOptions - Not able to filter based on labels

I want to watch Kubernetes pod events for a certain application. I went with NewSharedInformerFactoryWithOptions. I have added appropriate labels selector, But

Golang Context Timeout Not Working Via Test

I have some async calls that runs and I'm setting a timeout for all via the context. ctxWithTimeout, cancel := context.WithTimeout(ctx, getTimeoutDuration()) de

Error while using gorilla/mux, "vendor/" befor the github path in import

It appears the error is regarding the vendor, i thought I didn't used it for this project but appears like a github package is being imported with a vendor/ pre

How do I do table locking in GORM(Golang)?

How do I do table locking in GORM(go-gorm)? I found a way to do row locking, but could not find a way to do table locking.

VSCode Debugger not working under Rosetta

when trying to use the VSCode Debugger, I get an error message: "Failed to launch: could not launch process: can not run under Rosetta, check that the installed

Go: How to remove data link layer from a packet?

I am using the gopacket library, and I read packets from the wire. Right now, all packets I read contain four layers: Link, Network, Transport, and Application

Generic type in a switch statement

Just started learning generics. I'm making a command processor and I honestly don't know how to word this so I'm just going to show an example problem: var ErrI

Serving react static files in golang gin-gonic using go:embed giving 404 error on reloading on frontend URL

I have built a go application using gin and go1.17. I am using go:embed to to serve static content for a SPA app built using react. (trying the approach as sugg

can't have email on existing user golang

I'm trying to check if an user already have a email. I wrote a function like this : func IsUniqueEmail(body io.ReadCloser) (database.User, error) { connection :

How to make a selection of row cassandra by basing on variable criteria?

I'm currently working on a social network with Cassandra. I am planning to implement a system of posts and post recommendations in my site. My problem is that I

kafka retry many times when i download large file

I am newbie in kafka, i try build a service send mail with attach files. Execution flow: Kafka will receive a message to send mail function get file will downlo

How to do Unit Testing with gorm

I'm new in Go and unit test. In my project am using Go with gorm and connecting mysql database. my queries is how to unit test my code: My code is below(main.go

How do you execute terminal commands from Golang?

I'm creating a CLI tool in Golang, and I'm new to both Golang and making tools for the terminal. I need to execute terminal commands right from my program (spec

remove Witness from Source WitnessV0PubKeyHash

I'm trying to convert a script that is build on btcutil and wire with Witness (Segwit) to without Witness. Mine blockchain doesn't support Segwit. Now the most

Golang validate a yaml structure

Im a newbie in golang. I am trying to validate a yaml structure prof: res: - ed: app: conf: For that i have read the yaml file using ioutil,

Recursive calls from function started as goroutine & Idiomatic way to continue caller when all worker goroutines finished

I am implementing a (sort of a) combinatorial backtracking algorithm in go utilising goroutines. My problem can be represented as a tree with a certain degree/s

Mongodb aggregate lookup for merged collections?

Merged queries takes more time for requests, for instance having a username query from user collection and having a query from productpost, costs server process

Is there a way in Golang Generics to create something like "extends" in Typescript?

I am trying to create a function using Go Generics that accepts any structs that meet minimum struct criteria. Something like <T extends {name: string, age: