Category "go"

Golang field type validation

I have a struct type InputData struct { SomeNumber int `json:"someNumber"` SomeText string `json:"someText"` } I do json.Unmarshal my http reque

Golang / CosmosDB Pagination

I'm trying to implement pagination while selecting records from CosmosDB using cosmosapi package. The azure documentation states that continuation tokens never

How Can we Configure Camunda Process Engine in Golang?

I found links on process engine Configuration https://docs.camunda.org/manual/7.16/reference/deployment-descriptors/tags/process-engine/ But how to use this in

convert int to ascii - more than one character in rune literal

How do I convert into to its ASCII? In java it's System.out.println((char)(49)); //gives 1 I tried a := '42' fmt.Println(rune(a)) I get more than one character

Permission denied when installing go mockgen

I am trying to install the mockgen package on go, but I keep receiving a permission denied without knowing why: go install github.com/golang/mock/[email protected]

How to ignore a .go file in a module?

I am rewriting in Go a home-grade program of mine that was previously in Python, learning on the way. As I reconsider whole sections of the code, it would be gr

Panic Related to Garbage Collector When Running Go Program

I installed a Go program from GitHub and when I run it, I get the error, panic: Something in this program imports go4.org/unsafe/assume-no-moving-gc to declare

package to encapsulate float64 in protobuf

I was working in a microservice to create subscriptions in Stripe. One of the fields is listed as a float64 where I set it up as a float in the .proto file. Thi

When the TCP connection close in this code?

When I read this opensource code. I have two questions about the two functions: func listenTCP() { for { conn, err := tcpListener.Accept() i

Is there any query builder for InfluxDB in Golang?

I am new to InfluxDB and trying to do query in my local InfluxDB using Go client. The parameterised version of this doesn't seem to work as intended and they me

how to import vscode path

I am receiving the following error from vscode when i try to edit a go file: "Error loading workspace: You are outside of a module and outside of $GOPATH/src. I

How to parse POST request body with arbitrary number of parameters in Go Fiber/ fasthttp

type Person struct { Name string `json:"name" xml:"name" form:"name"` Pass string `json:"pass" xml:"pass" form:"pass"` } app.Post("/", func(c *fiber.Ct

what does "lst := List[int]{}" mean in Go [duplicate]

Here is the part of Go code I am reading: func main() { var m = map[int]string{1: "2", 2: "4", 4: "8"} fmt.Println("keys m:", MapKeys

Location of methods in memory [duplicate]

I am new in Go world, the question could be obvious. Let's say I have a struct Example, which has some methods: type Example struct {} func (

fabric invoke chaincode error: Failed to get endorsing peers: no endorsement combination can be satisfied

I have set up my fabric network with 3 orderers in one organization and a consortium with 5 organizaitons successfully. Each organization has only one peer node

Go import scope lookup for protobuf types

I'm building a transpiler and need to understand the protobuf/go scope lookup system. I've been trying to google the docs and finding no luck. Q: Is there a sha

How to set lower or upper in gorm model when primary key is mixed

I have a table with 3 columns: emrID (this is the primary key) patient_name (string) Comment(string) This my code import ( "gorm.io/driver/sqlite" "gorm

How can I force go mod to accept a module that declares its path being different from its go.mod?

When I run go mod tidy, it breaks because a package imported by my project imports another package using path github.com/coreos/bbolt, but when it fetches the p

I add file to my API and got invalid character '-' in numeric literal in POST API

I know this code need to send a JSON instead of form data in the API err := ctx.ShouldBindJSON(&modelAdd) if err != nil { return err } But

How to validate an email address in Go

I have checked the StackOverflow and couldn't find any question that answers how to validate email in Go Language. After some research, I figured out and solved