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

2021-05-18 Thread Nick Keets
Thanks everyone for your responses. structs is interesting, but archived, pre modules even. Using reflect directly also doesn't seem that bad and I do want error handling, so it looks like nothing beats JSON in terms of UI. On Mon, May 17, 2021 at 6:22 PM Howard C. Shaw III wrote: > The

[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

Re: [go-nuts] Modules... why it has to be so painfull?

2021-04-08 Thread Nick Keets
On Thu, Apr 8, 2021 at 2:08 PM 'Carla Pfaff' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Thursday, 8 April 2021 at 12:48:28 UTC+2 nick@gmail.com wrote: > >> But what if you don't even have a domain for your source code? Sure you >> can use a fake domain like "foo.example" >> >

Re: [go-nuts] Modules... why it has to be so painfull?

2021-04-08 Thread Nick Keets
I think the problem is that this process is inconvenient, not that it is not possible. Modules work great if you publish everything on GitHub, or something similar. But what if you don't even have a domain for your source code? Sure you can use a fake domain like "foo.example" and then use

Re: [go-nuts] still struggling to understand modules

2021-02-23 Thread Nick Keets
Hello rob, here's what I do. For every dir in ~/go/src run go mod init with the dir name. e.g.: cd ~/go/src/foo go mod init foo cd ~/go/src/bar go mod init bar ... If package foo depends on libfoo (also in ~/go/src) you can add a replace line in foo's go.mod e.g. echo "replace libfoo =>

Re: [go-nuts] compress/flate

2020-07-20 Thread Nick Keets
Updating those 2 lines would be the least of our problems if this value ever changes. On Fri, Jul 17, 2020 at 12:33 PM Jan Mercl <0xj...@gmail.com> wrote: > On Fri, Jul 17, 2020 at 11:23 AM Heisenberg wrote: > > > > Constant definition in token.go: > > > > literalType = 0 << 30 > > > > The only

Re: [go-nuts] Go 2 generics counterproposal: giving up restricting types

2019-05-31 Thread Nick Keets
On Thu, May 30, 2019 at 9:26 PM Ian Lance Taylor wrote: > One of my guidelines for an acceptable generics proposal is that > people can write Min and Max. Your proposal admits that it doesn't > permit that. I think that is a problem. I'm fine with the general > idea of "do 80% of the job" but