Category "go"

Go gorilla websocket write deadline

I am unable to understand this part of the code which uses c.conn.SetWriteDeadline function. // Time allowed to write a message to the peer. writeWait

Terraform Custom Provider - Data Source Schema

I am working on creating a custom terraform provider by using terraform sdk. I am trying to read data from the existing API GET call. I am finding it difficult

I'm testing with go openAPI

I'm testing with OpenApi and as an example with https://github.com/d-vignesh/Todo-App-with-OpenAPI but if i run this, i get the following error: .\main.go:9:77:

ICMP Golang with raw socket, control message has nil value

I'm playing around with the ICMP raw socket of Golang. I'd like to read the TTL which is part the control message returned by ReadFrom(buffer). Weirdly this val

How to handle different JSONs in Golang? [duplicate]

I am a novice developer and faced such a problem, I can receive a json which in some cases has different data, for example Example 1: { "order

How to handle different JSONs in Golang? [duplicate]

I am a novice developer and faced such a problem, I can receive a json which in some cases has different data, for example Example 1: { "order

strconv.ParseInt fails if number starts with 0

I'm currently having issues parsing some numbers starting with 0 in Go. fmt.Println(strconv.ParseInt("0491031", 0, 64)) 0 strconv.ParseInt: parsing "0491031":

Gorm freeze while connect to mysql on AWS (no errors)

this code stacks on aws, but locally works fine, no errors func Connect() { dsn := fmt.Sprintf( "%s:%s@tcp(%s:3306)/%s?charset=utf8&parseTime=True&

Golang TCP Connection Slow when Server Doesn't Have Backlog Available

Update With the added pthreaded C client, the problem is recreated, indicating the long connection times are part of the TCP protocol, rather than specific impl

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 :