Skip to main content
2 votes
2 answers
136 views

Golang map equivalent to postgres tstzrange and contains operator?

I'm looking for a way to cache data using a map (or equivalent) but instead of a comparable key (like int, string, etc) it would be lower and upper time boundaries. I would then be able to perform a ...
Jeff's user avatar
  • 602
1 vote
1 answer
97 views

Trying to add a click listener to GO Maps Marker in WP GO MAPS Pro plugins

I'm using WP Go Maps Pro plugin. I'm trying to add a click event listener to a google map marker. I get all the markers infos, but for some reason it won't add the listener. Any idea what I'm doing ...
Rom's user avatar
  • 133
0 votes
0 answers
160 views

is there a way to get the original order of map[string]interface{}

I have a use case where the input payload consumed by my REST endpoint should flush it in the same order. There is no specific pattern to the input, so I'm saving it as map[string]interface{} and that ...
ArigatoManga's user avatar
0 votes
0 answers
355 views

Appending to slice in map which is type of map[any]any

I want to append to slice in map which is defined as map[any]any I am having type conversion issues and don't know how to treat result[index][ABSPath] as slice so I can append data to it Here is the ...
John Doe's user avatar
0 votes
1 answer
87 views

Iterate over map of `interface{}` and call the same method on each item in Golang

I am working on a simple Console game to learn Go and got stuck on a seemingly simple issue that would be no problem in other languages, but seems almost impossible in Go. I have a map of interfaces ...
matronator's user avatar
2 votes
0 answers
1k views

Why doesn’t 'dive' work on gin? (about validator)

I just would like to do like the below about validation on Gin(Golang). type Accounts struct { Accounts []*Account `json:"accounts" binding:"required,dive"` } type Account ...
TomoEno's user avatar
  • 21
1 vote
1 answer
53 views

Golang gives different result everytime using map for AOC 2021 Day 6 problem

I've been trying to solve Advent of Code 2021 and in day 6, I am trying this solution but the result is different everytime. What seems to be the problem? Is there any memory leakage with map? The ...
Kanuor's user avatar
  • 45
-1 votes
1 answer
280 views

Transform a golang map into another structure of map

I need help for transforming this input map into the output map. I try with switch/case and for but I didn't succeed it. Thanks a lot ! Input : Values{ "toto_voiture_brand&...
Mona's user avatar
  • 23
0 votes
0 answers
99 views

Slice to Map of pointers duplicates values

This is a beginner question about why I get such a result when trying to obtain a Map from a Slice in go lang. I have this code: func (p *ProductsStruct) ToMap() map[int32]*Product { result := map[...
Lupascu Gabriel Cristian's user avatar
0 votes
1 answer
155 views

how to normalize (1:N) a csv file to a map in Go?

I'm trying to normalize a structure from a CSV file, which is like this: name, note 'Joe', 5 'Joe', 3 'Ashley', 1 'Ashley', 7 'Ashley', 4 to a map, that after read that file, will be reduced to: map [...
Alan Barbiero's user avatar
3 votes
1 answer
113 views

add colly package output text to map in golang

i was making a web scraper with colly package, where it collects the ContestName and ContestTime from a website and make a json file. so i did like this Contests := make(map[string]map[string]map[...
Vinay Kumar Rasala's user avatar
0 votes
1 answer
124 views

Trying to run a query in BQ passing labels in GoLang, but getting panic error

I am trying to run the following code to query in BQ passing labels in GoLang, but getting panic error (You may refer attached image for linenumbers). I am new to Golang, can someone please guide here?...
newbie's user avatar
  • 5
-3 votes
1 answer
154 views

How to acheive the order of insetion in nested maps using golang [duplicate]

In my project we are using nested map map[string]map[string]map[string]string for insertion of the data into cache. While preparing the data the db data has to be compared with the cache data(nested ...
madhusri mannuru's user avatar
1 vote
1 answer
645 views

What determines the order in which the results are generated from "for range" iteration of golang map?

I try to firgure out that what determines the order of results generated from "for range" iteration of golang map. I found that it is neither determined by the order of keys nor by the order ...
Tsiao Wang's user avatar
0 votes
1 answer
2k views

Go: cannot call pointer method getFirstName on "Struct" [duplicate]

I have a simple struct and receiver. I try to set the map with the struct and then call the receiver. Like that: package main import ( "fmt" ) type myStruct struct { FirstName ...
user63898's user avatar
  • 31.2k

15 30 50 per page
1
2 3 4 5