Category "go"

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:

Simplifying AWS SDK GO v2 testing/mocking

Amazon has a super useful article describing how to unit test AWS SDK Go v2. I understand their motivation to depart from the "old" way of unit testing the v1

Go test not running specific test despite flag inclusion

Folder structure: ./test ├── abc │ └── abc_test.go └── run_test.go run_test.go package test impo

Strange issue with terminal getting messed up: vim/coc-nvim/golang/gopls/zsh/gpg

I am having a very annoying issue and I don't know exactly what's the problem. It could have loads of possible causes, so please bear with me trying to fix this

aws-sdk-go-v2 set custom header on PutObjectInput

I am in a situation where i need to set a custom header on putting an object to an s3 compatible storage system. _, err := uploader.Upload(ctx, &s3.PutO

aws-sdk-go-v2 set custom header on PutObjectInput

I am in a situation where i need to set a custom header on putting an object to an s3 compatible storage system. _, err := uploader.Upload(ctx, &s3.PutO

How to unmarshal an escaped JSON string

I am using Sockjs with Go, but when the JavaScript client send json to the server it escapes it, and send's it as a []byte. I'm trying to figure out how to pars

How are the checksums in go.sum computed?

I looked at https://go.dev/doc/modules/gomod-ref and https://go.dev/ref/mod#go-mod-tidy, and on neither page could I find any documentation that explains how th

Correctly log protobuf messages as unescaped JSON with zap logger

I have a Go project where I'm using Zap structured logging to log the contents of structs. That's how I initialise the logger: zapLog, err := zap.NewProductionC

Are function variables concurrency-safe in golang?

I have following types declared type TestFn func(id int, ctx context.Context) error var Func1 = TestFn(func(id int, ctx context.Context) error { // do some w

Why do I get "undeclared name: any (requires version go1.18 or later)" when using any instead of interface{}? I am using Go 1.18

When trying to use any instead of interface{} with the Go 1.18 toolchain, you can get the error: undeclared name: any (requires version go1.18 or later) Why is