Category "go"

Building Go apps with private gitlab modules in Docker

I am trying to build my go apps on a docker file. Inside my go.mod there is private package that needs authentication/ssh. This question is similar to Building

MongoDB - Group by inner element

I am explaining with a simple example see my MongoDB collection looks like this: [ { pid: erwer, qty: 3, LevelDetails: {

Gorm Update and Get the Updated Rows in a single operation?

Is there any way to get the rows that have been updated using the update command in Gorm, using a single operation.

Unable to read "request.Body" in Go Chi router [duplicate]

Consider the following code in main/entry function r := chi.NewRouter() r.Use(middleware.RequestID) r.Use(middleware.RealIP) r

How to get in OpenTelemetry otelgin middleware the traceid or full context to provide it to grpc clients?

Atm, I work on a bunch of distributed microservices in go which I want to trace. I have an "api-gateway" that works via REST and then calls the needed microserv

Go boltDB query using bolthold 3 conditions

So I had this question before and I had an answer below the question which worked, but I just realized that the query I came out with does not work as planned.

How to exclude coordinates which overflow matrix

The task is to write a function that returns all its neighbors for an element. Diagonal elements are not considered neighbors. In general, the problem is solved

Printing strings and characters as hexadecimal in Go

Why cyrillic strings in hexadecimal format differ from cyrillic chars in hexadecimal format? str := "Э" fmt.Printf("%x\n", str) //result d0ad str :

Reading a Config File in Android from a Golang Bind Service

I have a Golang program from which I have created a package using gomobile bind. It creates two files abcd.jar and abcd.aar. I have copied these 2 files to the

Unit Testing for pgxpool

I am looking to write unit tests for Go code that uses pgxpool to interact with a postgres database. Is there a test framework that will stand up a dummy or moc

Does copy() function more efficient than slice[start:end] operators? [duplicate]

My goal is to validate whether the tutorial given by w3schools is true, I use w3schools#Memory Efficinecy as reference. I quote from the tutor

AWS Route53 - Adding Simple Record

I am able to add "Weighted" A records for the AWS Route53 using the API, using [Weight: aws.Int64(weight)], it works great using the code below. But how

Error message "go: go.mod file not found in current directory or any parent directory; see 'go help modules'"

I just updated to the new version of Go - Go version 1.16.2 Linux/amd64 and am getting an error when I build a Hello, World! example: go: go.mod file not found

Heroku Go app crashes, version `GLIBC_2.32' not found, required by bin/main

So I have a very simple web app that just serves an html file right now, and my code works on my laptop, but not on heroku's servers. There are no errors while

Trouble with go get install for mcumgr

I am trying to install MCUMgr on MACos. Here is a link for mcumgr: https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html I install the Go Progr

How to get html element inside script

using go-colly how to get element inside script tag? ie: <script language="Javascript">jQuery( document ).ready(function() {jQuery("#table-hold").html('&l

Deadlock in book <The Go Programming Language>, how it would happen and why it happen?

There are several times in this book talk about deadlock regarding to incorrect usage of goroutine and channel, and I failed to grasp why the deadlock happen. F

Getting different output for slight variation in input for unicode.IsNumber() function in Go

Why does unicode.IsNumber(rune(truncfloat)) returns false some cases? For 55.3 output is true For 58.3 output is false Below is my code: package main import (

How to get parameters in cloudformation template to launch using Amazon Go SDK?

I am having trouble writing a script in Golang to launch a cloudformation template that has several parameters. I am new to both sdk and golang, so I am runnin

Can't connect to Go Server in Docker container

I am trying to run a an HTTP Server written in Golang inside of a docker container and I keep getting connection refused. Everything is being run inside of an U