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 example
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 direc
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"
>>
>
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 replace
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 => ../libfo
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
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
In the same spirit, here is an interesting post about generics in Swift:
https://forums.swift.org/t/improving-the-ui-of-generics/22814
Swift if a more complex language and fairly different from Go, but it may
be of interest to people that are thinking about generics.
On Wed, Apr 10, 2019 at 3:27