Re: [go-nuts] How to encode/decode string to binary in golang

2023-03-15 Thread Jesper Louis Andersen
On Tue, Mar 14, 2023 at 10:25 AM Van Fury wrote: > Am developing a server (diameter) which will response with an AVP > SIP-Authenticate. > In the specification > > " The SIP-Authenticate AVP is of type OctetString and It shall contain, > binary encoded, the concatenation of the authentication

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Frank Juedes
On 2023-03-15 06:06, Jan Mercl wrote: On Wed, Mar 15, 2023 at 11:03 AM Frank Jüdes wrote: Well, that didn't go very far:https://go.dev/play/p/UtsrRar9J0Q Fails with the messages ./prog.go:15:11: invalid operation: cannot index p_Map (variable of type MAP constrained by DataMap)

Re: [go-nuts] Help with language change proposal

2023-03-15 Thread Landon Cooper
Thanks very much for the feedback, Axel. I didn't think it was harsh, this is just the kind of information I needed before burning needless effort on the idea. Getting started with these conversations is quite intimidating because there is so much information and history, it's hard to find what

[go-nuts] error on installing cobra package using command go get github.com/spf13/cobra

2023-03-15 Thread akhil agrawal
Hi Team, i am getting following error go get github.com/spf13/cobra github.com/spf13/cobra imports github.com/spf13/pflag: cannot find module providing package github.com/spf13/pflag on go get github.com/spf13/cobra command,. Can someone suggest? -- You received this message because you are

Re: [go-nuts] how does go generate interact with build tags?

2023-03-15 Thread Rangel Reale
Sorry to revive this very old topic, but I didn't manage to make this work today, is it still supposed to work? ("go generate" using build tags). On Thursday, 19 February 2015 at 22:13:53 UTC-2 Dan Kortschak wrote: > You are absolutely right. The bug is invalid. > > thanks > > On Thu,

Re: [go-nuts] error on installing cobra package using command go get github.com/spf13/cobra

2023-03-15 Thread Ian Lance Taylor
On Wed, Mar 15, 2023 at 11:10 AM akhil agrawal wrote: > > Hi Team, i am getting following error > go get github.com/spf13/cobra github.com/spf13/cobra imports > github.com/spf13/pflag: cannot find module providing package > github.com/spf13/pflag > on go get github.com/spf13/cobra command,. >

[go-nuts] Help to choose the right type of the key for a map.

2023-03-15 Thread alex-coder
Hi All ! There is a package named ast, inside there are a lot of structures like: ast.Comment, ast.Field, ast.Node and so on. And I whould like to use types of those structure as a keys. So, I could not figure out what type of the key I should use in order to store in a map something under the

[go-nuts] Re: Help to choose the right type of the key for a map.

2023-03-15 Thread alex-coder
the ast package it is possible to find there: ast package - go/ast - Go Packages thank you. среда, 15 марта 2023 г. в 19:16:59 UTC+3, alex-coder: > Hi All ! > > There is a package named ast, inside there are a lot of structures like: > ast.Comment,

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-03-15 at 12:55 -0400, Frank Juedes wrote: > > > Hi Dan, > Thank you very much for your answer, so that's the data structure > behind maps, very interesting. > I had actually thought about using unsafe pointers and then type- > casting, but that is how i would have done it in the

Re: [go-nuts] how does go generate interact with build tags?

2023-03-15 Thread Rangel Reale
Forget it, it is working, I was using a build tag of "generate" which is special, and the only one for which it doesn't work. On Wednesday, 15 March 2023 at 15:34:38 UTC-3 Rangel Reale wrote: > Sorry to revive this very old topic, but I didn't manage to make this work > today, is it still

Re: [go-nuts] Help to choose the right type of the key for a map.

2023-03-15 Thread Ian Lance Taylor
On Wed, Mar 15, 2023 at 9:17 AM alex-coder wrote: > > There is a package named ast, inside there are a lot of structures like: > ast.Comment, ast.Field, ast.Node and so on. > And I whould like to use types of those structure as a keys. > So, I could not figure out what type of the key I should

Re: [go-nuts] Help to choose the right type of the key for a map.

2023-03-15 Thread Ian Lance Taylor
On Wed, Mar 15, 2023 at 2:16 PM alex-coder wrote: > > Ian, thank you. > but may be the is any workaround ? > Use as a key not directly but like a derived from those interface/structure > types ? > Of course I may declare key like string and use switch + .(type) to mimic it. Sure, convert to a

[go-nuts] Re: Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
FWIW, I pasted my post into ChatGPT-4 and got what might be a plausible outline of an approach using httputil.NewSingleHostReverseProxy. But, as we know, LLM's are prone to hallucination. If you're curious, here's a share link. https://shareg.pt/cNoNdWc On Wednesday, March 15, 2023 at

Re: [go-nuts] Re: Looking for a specialized proxy package

2023-03-15 Thread Matthew Zimmerman
Honestly I'd probably use grpc and keep a constant connection from the IOT to the cloud. No ports/services required on the client at all and the server can still request things in real time. Like:

Re: [go-nuts] Re: Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
Thanks, Matthew. I know what RPC is, but have never considered it as a way to serve http from behind a NAT. I should say that the IOT's are part of a product that's been in the market for several years. My client likes the web interface we built and wants users to be able to access an IOT's

Re: [go-nuts] Help to choose the right type of the key for a map.

2023-03-15 Thread alex-coder
Ian, thank you. but may be the is any workaround ? Use as a key not directly but like a derived from those interface/structure types ? Of course I may declare key like string and use switch + .(type) to mimic it. So, a little bit more. there is a go standard package named ast. the docs about it

[go-nuts] Looking for a specialized proxy package

2023-03-15 Thread Michael Ellis
I posted a question about this on ServerFault last week but didn't get any answers other than a few comments from one person who said (basically) "use a VPN". That seems like overkill. I'm trying to find

[go-nuts] How to collect information in each package’s source code directory when building a project

2023-03-15 Thread Qingwei Li
I'm trying to collect information dumped in each package's source code directory when building a project. I have tried to ask in How to collect information in each package's source code directory when building a project - Getting Help - Go Forum (golangbridge.org)

Re: [go-nuts] Help with language change proposal

2023-03-15 Thread 'Axel Wagner' via golang-nuts
Hi, Some comments in-line: > > Who does this proposal help, and why? > go programmers who want to reduce boiler plate code. I believe you should definitely be more explicit with the problem you are trying to solve. "Today, if you want to do X, you have to write Y. That is bad, because Z".

[go-nuts] Re: what the asyncPreempt happens in flamegraph mean?

2023-03-15 Thread Brian Candler
[Aside: please don't paste images or coloured text. They're very hard to read] It's perfectly normal for your code to be interrupted once every 10ms or so for async preemption. You'll see a load of system calls, but it should not be making your code run "slowly". If you find that "most of the

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Frank Jüdes
Hi Kurtis, good to know that a map will always be "kind of" passed by reference to functions. I have verified that with a short test-program on the playground -> https://go.dev/play/p/HxdgpM-QozM So in the next code-review all those *[maptype] references will be removed. Things are very

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Frank Jüdes
Well, that didn't go very far: https://go.dev/play/p/UtsrRar9J0Q Fails with the messages ./prog.go:15:11: invalid operation: cannot index p_Map (variable of type MAP constrained by DataMap) ./prog.go:16:26: cannot range over p_Map (variable of type MAP constrained by DataMap) (MAP has no core

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Jan Mercl
On Wed, Mar 15, 2023 at 11:03 AM Frank Jüdes wrote: > > Well, that didn't go very far: https://go.dev/play/p/UtsrRar9J0Q > Fails with the messages > ./prog.go:15:11: invalid operation: cannot index p_Map (variable of type MAP > constrained by DataMap) > ./prog.go:16:26: cannot range over p_Map

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2023-03-14 at 19:56 -0700, Kurtis Rader wrote: > Maps are a special-case. You can't pass them "by value" in the sense > you mean because a "map" value is a very tiny structure that contains > a pointer to the actual map. The passed value is a pointer to the header, otherwise changes to

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread Brian Candler
Which is also the reason why you can't insert into a nil map - you have to make() one. On Wednesday, 15 March 2023 at 10:58:09 UTC Dan Kortschak wrote: > On Tue, 2023-03-14 at 19:56 -0700, Kurtis Rader wrote: > > Maps are a special-case. You can't pass them "by value" in the sense > > you mean