Category "go"

How to measure RTT/latency through TCP clients (created in GoLang) from a TCP server created in GoLang?

so I am hosting a TCP server through GoLang and then I want to connect to my TCP server using multiple TCP clients and measure the RTT every time a new client i

How to make a one-time payment in Stripe?

I am trying to make my site do a one time payment and verify, /payment/confirm will verify the payment went through and add the item to the current user, and /p

Passing file from JavaScript to Go server

I am trying to pass a set of FORM values from client to server. FORM values include files, user names and other details as well. how do i decode the file in the

Ignoring an object in struct is nil and not when it's an empty array

Is it possible to only use omitempty when an object is nil and not when it's an empty array? I would like for the JSON marshaller to not display the value when

kubectl substring match using go-template

I am trying to find a way to match a substring in the go-template in kubectl. I am only able to find operators like those listed below, however, none of them is

How can you read POST data from a javascript XMLHttpRequest in Golang?

Here's the javascript function called: function cwk_submit_form() { var form = document.getElementById("FORM_ID") var XHR = new XMLHttpRequest(); con

Ho to debug Go app with DLV and MODD on Docker

I'm running a Go app on the Docker and want to use VSCode to debug it via DLV at the same time using MODD for app rebuild. So far I cannot figure out how to con

Appending values to existing values of environment variables in go

How can I append another value to an existing value of a go environment variable? If CGO_CXXFLAGS has the value "-I/blah/blah" Since the following doesn't work

Use Go to encrypt message with ssh-rsa public key which then can be decrypted using openssl rsautl -decrypt

I have been trying to solve this for days. In Go code I am looking to take a ssh-rsa public key like: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGnnY4LuLq7Bs7VnFk2V

How to decode Flutter iso8601 DateTime to Go Api RFC3339 pgtype.Date and pgtype.Timestamptz

In my Go API I'm trying to use json decode to parse the following json. {"contract_id":0,"date_established":"2022-04-03T00:00:00.000","expiry_date":null,"extens

Port scanner using net.DialTimeout always manages to connect even when ports are closed

---UPDATE I send the code to a friend who then tested it on his pc. The output was as it's supposed to be. This means the issue is not code related but somethin

go application build with bazel can't link when running inside container

I am trying to containerize my application build, though, when running the build that uses bazel with bazel-gazelle inside a container I will get this error: $

Go: Invalid memory address or nil pointer dereference when reading files and strings at same time

I have the following function waitForInput that listens for TCP input, after the connection has been created and that one has been assigned to the client struct

HTTPS for Golang API

I am new to Golang and I did set up a "hello world!" test message for a Golang API on our VPS. It works just fine at http://www.example.com:8080/hello. I would

How to get monotonic part of time.Time in Go

am currently working with timestamps and I would like to store in a variable the monotonic clock reading section. Let's say that I have this: 2022-03-31 10:20:2

golang access values from map inside a map

I am leveraging Avi Go SDK to fetch avi healthmonitor configuration as below var healthmonitormap map[string]interface{} err = aviClient.AviSession.GetObjectByN

Websocket with special characters

I am using websocket with client nodejs and server golang (net library) via tcp. I am read data sent from client but many special chars. Some one can help me ab

What is the meaning of 'leak/leaking param' in Golang Escape Analysis

func main() { i1 := 1 A1(&i1) } func A1(i1 *int) *int { return i1 } And the result of escape analysis is ./main.go:18:9: parameter i1 leak

Encode JWT properly

I'm trying to write simple JWT implementation with these functionalities: Generating token using HMAC Validating token (if signature is correct or exp is not ti

Protobuf golang - How to read values from *_struct.Struct [closed]

I am trying to convert Protobuf *_struct.Struct to map[string]interface{} what is the right way to do it? func convertToMap(input *_struct.Str