Category "go"

"go get" command not generating the bin folder when it is run in a shell script

I have installed go package. When I go to the instance(VM) and run the command go get github.com/linkedin/Burrow from a terminal/cmd it is downloading both "sr

How to get data from such blob:http:// url in golang?

I have an api written in go, which takes the input in form of blob file, actually a blob url from frontend , When the file gets uploaded to s3 it makes an empty

Recursive data structure unmarshalling gives error "cannot parse invalid wire-format data" in Go Lang Protobuf

OS and protobuf version go1.18.1 linux/amd64, github.com/golang/protobuf v1.5.2 Introduction I am trying to use recursive proto definitions. .proto file message

How to create a unique key for a map

I'm creating a structure where a developer can store a reference to something and retrieve it when needed using a reference key, but not delete the reference. H

Golang: How to color fmt.Fprintf output?

I know I can add colors to fmt.Println output with something like: package main import ( "fmt" ) func main() { colorReset := "\033[0m" colorRed :=

How to initialize a nested struct?

I cannot figure out how to initialize a nested struct. Find an example here: http://play.golang.org/p/NL6VXdHrjh package main type Configuration struct { V

How can i add enum in gorm?

I am writing PostgreSQL table schema. type TestTable struct { ID int `gorm:"column:id;primaryKey;autoIncrement"` CarType string `gorm:"colum

How to fetch blob from azure

I am trying to download some data from Azure Blob Storage in Go via the official azure-sdk-for-go. To setup my development environment I have successfully logge

How do I get the querystring using Golang's Fiber?

My code app.Get("/event/*", func(c *fiber.Ctx) error { // GET THE ACCOUNT FROM THE PATH fmt.Println("PATH")

Golang: Gorm Error on insert or update on table violates foreign key contraint

Im trying to create a REST service using Gorm that on startup will drop the database tables from my Postgres DB and then create and populate them with test data

GORM select certain column with preload

Let's say I have these struct that represent my models type QuestionHeader struct { QuestionHeaderId int `gorm:"primaryKey;column:question_id" json:"questi

gin/golang gin-gonic does not parse time.Time properly for unix json?

I cannot find the way to execute this code properly with UNIX: package main import ( "time" "github.com/gin-gonic/gin" "net/http" ) type Things struct

How to assign or return generic T that is constrained by union?

In other words, how do I implement type-specific solutions for different types in a union type set? Given the following code... type FieldType interface { s

Facing issue with having generic as return type in Golang

I'm invoking a function from another library whose return signature is defined as under: (*studentlib.Student[StudentResponse], error) Student is defined as: t

adldap2: unable to retrieve custom user attribute

I've written a small php script to retrieve all the users in a certain group and obtain two values, username and employeeid. Unfortunately, the second field is

How to pass timezone to cron expression using gocraft?

I am using github.com/gocraft/work for creating cron jobs. My server time is in UTC and I want cron job to be executed based on specific timezone, is there any

How can i solve my Error by Connecting golang with MongoDB?

I have a problem with connecting the MongoDB to an API that is written in Golang. If you can help me, I would be really grateful. I don't find anything when I g

Range over posts in nested section in hugo

I use this code to show related posts in the same sections for posts in /content/posts. However, the code stops working when I move the content to a nested sect

Convert regexp.FindStringIndex results to character indices

The regexp.FindStringIndex(s string, n int) []int function returns byte indices of matches. In simple scenarios, these locations correspond to the "character p

i am working on supply chain DApps .here i want to add budget with ownername only not with the whole block

type Product struct { ID string `json:"id"` Name string `json:"name"` Area string `json:"area"` OwnerName string `json:"own