[go-nuts] Re: Map to struct and vice versa

2021-05-17 Thread Howard C. Shaw III
The examples given in other responses are great if you need to handle arbitrary or unknown maps and very much fit the 'easy way' part of your initial question. But you also asked at the end 'is there a more direct way?'. If you actually know what you are getting, you can code it entirely

Re: [go-nuts] gonum plot : font error

2021-05-17 Thread Fred
Thanks Carla and Sébastien for your quick answer ! Carla your solution works, when I use modules I do not have font errors. What is strange is that I was not using modules in any computer to try this example and it was working in one an not the other :) Le lundi 17 mai 2021 à 15:10:55 UTC+2,

Re: [go-nuts] gonum plot : font error

2021-05-17 Thread 'Sebastien Binet' via golang-nuts
Salut Fred, On Mon May 17, 2021 at 14:11 CET, Fred wrote: > Hi, > I have 2 computers with Linux Manjaro and go version 1.16.3. > The same scatter plot > works > on > one computer and produces on the other these already known errors

[go-nuts] Re: gonum plot : font error

2021-05-17 Thread 'Carla Pfaff' via golang-nuts
You should really use modules. The module name is "gonum.org/v1/plot", not "github.com/gonum/plot". $ mkdir scatter-demo $ cd scatter-demo $ go mod init scatter-demo $ edit main.go # Copy and paste code from https://gist.github.com/sbinet/602522b7399ead414e279e2261d81095 into main.go # Replace

[go-nuts] gonum plot : font error

2021-05-17 Thread Fred
Hi, I have 2 computers with Linux Manjaro and go version 1.16.3. The same scatter plot works on one computer and produces on the other these already known errors : #

[go-nuts] Re: Generics and parentheses

2021-05-17 Thread Johann Höchtl
watso...@gmail.com schrieb am Mittwoch, 15. Juli 2020 um 04:44:53 UTC+2: > Guillamets are worth consideration. They are common on European keyboards > and avoid all the syntax ambiguities. > > > They are common in the french-speaking part of europe. Even the OPs statement > A typical computer

[go-nuts] Re: Map to struct and vice versa

2021-05-17 Thread Mock ***
Hi Nick, I understand , please check if this pkg may help you https://github.com/fatih/structs, Thanks On Monday, May 17, 2021 at 2:58:54 PM UTC+5:30 Amnon wrote: > https://programmersought.com/article/93641771999/ > > On Monday, 17 May 2021 at 10:26:14 UTC+1 nick@gmail.com wrote: > >>

[go-nuts] Re: Map to struct and vice versa

2021-05-17 Thread Amnon
https://programmersought.com/article/93641771999/ On Monday, 17 May 2021 at 10:26:14 UTC+1 nick@gmail.com wrote: > Is there an easy way to go from a map to a struct and vice versa? e.g. > going from: > m := map[string]interface{}{"a": "x", "b": 5} > > to an instance of: > type T

[go-nuts] Map to struct and vice versa

2021-05-17 Thread Nick Keets
Is there an easy way to go from a map to a struct and vice versa? e.g. going from: m := map[string]interface{}{"a": "x", "b": 5} to an instance of: type T struct { A string B int } I can do this going through JSON (marshal the map, unmarshal into struct), but is there a more