[go-nuts] MarshalJSON() output encrypted json

2019-12-26 Thread Gert
https://play.golang.org/p/6qKkJhVsnU1 type Payload struct{} func (p Payload) MarshalJSON() ([]byte, error) { return []byte("my custom encryption stuf"), nil } func main() { p := Payload{} j, err := json.Marshal(p) if err != nil { fmt.Println(err) } fmt.Println(string(j)) } json: error calling M

Re: [go-nuts] Simple worker pool in golnag

2019-12-26 Thread robert engels
I think it is more complex - or simpler :) - than that. A lot depends on the Kafka client - for example the sarama client recommends one client per producer/consumer, other clients may multiplex on the same client so having more than one consumer (sender) may not be beneficial if the IO is fully

Re: [go-nuts] Simple worker pool in golnag

2019-12-26 Thread Amarjeet Anand
Thanks Ian for the resources. Appreciate it a lot. On Fri, Dec 27, 2019 at 10:57 AM Ian Lance Taylor wrote: > On Thu, Dec 26, 2019 at 8:12 PM Amarjeet Anand > wrote: > > > > I have to produce some task to kafka parallely. So I want to implement a > simple worker group pattern in go. > > Bryan

Re: [go-nuts] Simple worker pool in golnag

2019-12-26 Thread Amarjeet Anand
Hi Robert Actually the code above is simplified to make it easy to understand. Thanks for the suggestion on variable namings... Will improve that. The scenario is like the producer functions(produceTaskOfType1ToChan() and produceTaskOfType2ToChan()) will produce a list of strings to the channel.

[go-nuts] Re: issue with yaml processing

2019-12-26 Thread R Srinivasan
solved my issue. Thanks so much. srini On Thursday, December 26, 2019 at 8:29:19 PM UTC+5:30, howar...@gmail.com wrote: > > You want to add the flow directive to the struct's attributes. From the > docs: > > flow Marshal using a flow style (useful for structs, > sequences an

Re: [go-nuts] Simple worker pool in golnag

2019-12-26 Thread Ian Lance Taylor
On Thu, Dec 26, 2019 at 8:12 PM Amarjeet Anand wrote: > > I have to produce some task to kafka parallely. So I want to implement a > simple worker group pattern in go. Bryan has a good talk on this general topic: https://www.youtube.com/watch?v=5zXAHh5tJqQ&list=PL2ntRZ1ySWBdatAqf-2_125H4sGzaWng

Re: [go-nuts] Simple worker pool in golnag

2019-12-26 Thread robert engels
Yes, the code doesn’t work :) - it will only ever produce 2 items - unless that was expected - even so, you want the N workers doing work, and probably a constant number sending to Kafka - but a lot depends on your “serial needs”. In your case you only have 2 workers producing work, and N sender

[go-nuts] Simple worker pool in golnag

2019-12-26 Thread Amarjeet Anand
Hi I have to produce some task to kafka parallely. So I want to implement a simple worker group pattern in go. Does the below code decent enough to take it to production? var workerCount = runtime.NumCPU()*7 + 1 func WorkerPattern() { taskWg := &sync.WaitGroup{} taskWg.Add(2) autoC

[go-nuts] golang library support for cmpv2 (RFC 4210)

2019-12-26 Thread sriram . ec
Hi, I m new to Go Language. I wanted to know if there are any libraries in Go which provides support for cmpv2(RFC 4210) protocol for certificate request (IR) and certificate renewal(KUR) I searched in https://go.dev/ and https://pkg.go.dev/, but didnt find any. Can you please let me know if su

[go-nuts] What happened to the Pholcus crawler?

2019-12-26 Thread Darko Luketic
I had a notification about some issue I commend on in https://github.com/henrylee2cn/pholcus Pholcus was a crawler written in Go, no English docs. I starred it, along with about 6200 others. I assume the guy was bullied by the Chinese government or parts of it, maybe killed, who knows, because

[go-nuts] Re: issue with yaml processing

2019-12-26 Thread howardcshaw
You want to add the flow directive to the struct's attributes. From the docs: flow Marshal using a flow style (useful for structs, sequences and maps). type Config struct { Contents []string `yaml:"contents,flow"` } Howard -- You received this message because you are

[go-nuts] Re: Question regarding a very tricky build set up

2019-12-26 Thread Amnon Baron Cohen
On Sunday, 22 December 2019 08:08:56 UTC, christoph...@gmail.com wrote: > > Oh my gosh. You could have saved all the time for writing that long long > question if someone had told you before that GOPATH is a thing of the past. > > Go has a new package dependency management system called Go Modu