I'm new to golang and I'm trying to build rest api, So far GET endpoints are working for me fine, but I'm having difficulties with POST method(creating user): T
I am using this library in go as Elasticsearch client: https://pkg.go.dev/github.com/elastic/go-elasticsearch/esapi#IndicesCreate.WithBody I have a problem on c
I have some code I've been dumped with and am actually stumped - I've worked with RPC and the JSON side of things before but I can't seem to get it to work over
Every time I resolve one issue I get into another similar but different. I need to convert into struts below JSON, but some parts are dynamic.
As generics have been released in Go 1.18 pretty recently, I've started learning them. I generally get the concept, because I have some Java experience from the
It is said that the 32 << (^uint(0) >> 63) expression can be used to detect whether the machine is 32 or 64 bits. How so? UPDATE: The question was c
Here is my python code (client side) : import requests import json import datetime headers = {'Content-type': 'application/json',"Authorization":"Bearer MYRE
What benefits arise from naming a function's return parameter(s)? func namedReturn(i int) (ret int) { ret = i i += 2 return } func anonReturn(i in
Here's an issue that's bedeviling me at the moment. When getting input from the user, I want to employ a loop to ask the user to retry until they enter valid in
I am pretty new to go and I was playing with this notify package. At first I had code that looked like this: func doit(w http.ResponseWriter, r *http.Request)
I just need a pointer to time.Time, so the code below seems invalid: ./c.go:5: cannot take the address of time.Now() I just wonder why? Is there any way t
I'm trying to bulk remove objects in minio as described here: objectsCh := make(chan minio.ObjectInfo) // Send object names that are needed to be removed to ob
I'm looking for the best way to calculate execution time in go. func main() { start := time.Now() time.Sleep(time.Second * 2) //something doing he
Does Go have something similar to Python's in keyword? I want to check if a value is in a list. For example in Python: x = 'red' if x in ['red', 'green', 'ye
Currently I am having an issue related to assign a Golang variable to a Javascript variable. I am using the Golang templates, so, from the backend I sent a JSON
I have a empty file called a.txt, I want to output a value(int) to it in a loop, and overwrite last content in file a.txt. For example, // open a file
I have tried: const ascii = "abcdefghijklmnopqrstuvwxyz" const letter_goodness []float32 = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077
For example, I have a string, consists of "sample.zip". How do I remove the ".zip" extension using strings package or other else?
I have a weird issue that arose when I took a break from this project. Upon starting up Goland, I'm riddled with errors when trying to run my project. The spe
Is there a StartsWith(str1, str2 string) function that can check if str1 is a prefix of str2 in Go language? I want a function similar to the Java's startsWith