Re: [go-nuts] json.Marshal

2018-10-31 Thread Dan Kortschak
https://play.golang.org/p/Se8wXfYZVZG You need to export the field: ``` Struct values encode as JSON objects. Each exported struct field becomes a member of the object, using the field name as the object key, unless the field is omitted for one of the reasons given below. ``` On Wed, 2018-10-31 a

[go-nuts] json.Marshal

2018-10-31 Thread Alex Dvoretskiy
11:07 PM (less than a minute ago) How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/cQNIKuGXRmj -- You received this message because you are subscribed to the

[go-nuts] json.Marshal

2018-10-31 Thread Alex Dvoretskiy
How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/AHcUO5IuByf -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re-building module with -buildmode=c-shared doesn't cache well

2018-10-31 Thread Justin Israel
(cross-posted from r/golang ) I've noticed a great improvement with caching when I build modules that haven't changed. The execution of "go build" is quite fast, and it is nice in a larger build script

Re: [go-nuts] [crypto/x509] SystemCertPool() print subjects of ca certs

2018-10-31 Thread Natxo Asenjo
On Wednesday, October 31, 2018 at 10:46:41 PM UTC+1, golan...@geek1.de wrote: > > Hy Natxo, > > check out the pkix [0] and asn1 [1] packages. You can try to parse the > DER encoded subject into RDNSequence. > > [0]: https://golang.org/pkg/crypto/x509/pkix/#RDNSequence > [1]: https://golang.o

Re: [go-nuts] [crypto/x509] SystemCertPool() print subjects of ca certs

2018-10-31 Thread golang-nuts via golang-nuts
Hy Natxo, check out the pkix [0] and asn1 [1] packages. You can try to parse the DER encoded subject into RDNSequence. [0]: https://golang.org/pkg/crypto/x509/pkix/#RDNSequence [1]: https://golang.org/pkg/encoding/asn1/#Unmarshal Spoiler: This should work: package main import "fmt" import "cr

[go-nuts] [crypto/x509] SystemCertPool() print subjects of ca certs

2018-10-31 Thread Natxo Asenjo
hi, as a learning exercise I would lke to loop through the system's certificate authorities store, and get the subjects of each certificate authority. I have this code: package main import "fmt" import "crypto/x509" func main() { store, err := x509.SystemCertPool() if err != nil {

Re: [go-nuts] Go 2 Error Handler Testing

2018-10-31 Thread Liam Breck
On Tue, Oct 30, 2018, 4:08 PM Burak Serdar wrote: > On Tue, Oct 30, 2018 at 2:15 PM Liam wrote: > > > > I've compiled an outline of Requirements to Consider for Go 2 Error > Handling. > https://gist.github.com/networkimprov/961c9caa2631ad3b95413f7d44a2c98a > > > > Recently I was asked about sup

[go-nuts] Go-Log : A better logger

2018-10-31 Thread Yashish Dua
Hey Gophers, I have built a Go logger package which provides utility on top of Go's normal Log package. Check this out! https://github.com/YashishDua/Go-Log -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-31 Thread robert engels
If you use interface based design it is repeated through out the code with no way to write a performant generic method. I am not a big fan of ‘reduced lines of code’ creating obscurity the hallmark of Go. In this case I think being able to pass a slice as an read only [] of interface makes MOR

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-31 Thread Space A.
It's already trivial 3 lines o code. Readable, light, and simple. And it's a question tbh, if topic starter even needs that code, or just a bad implementation. среда, 31 октября 2018 г., 18:47:37 UTC+3 пользователь Jake Montgomery написал: > > It is highly likely that when go2 comes out, with

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-31 Thread robert engels
That’s not what I mean - the function that you would be calling now (that takes the []interface{}) would probably be generic for performance reasons, so you wouldn’t need to do the conversion - with generics a lot of interface based code can go away - and probably will as people chase peak perfo

[go-nuts] protobuf spec file browser

2018-10-31 Thread Tharaneedharan Vilwanathan
Hi All, I am looking for a protobuf spec file browser much like Go source code browser using IDE like Visual Studio Code (VSC) or a web browser. I tried VSC but it only does syntax highlighting but it doesn't do things like "Go to definition". Any suggestions? Regards dharani -- You received t

Re: [go-nuts] database for protobuf - profanedb or similar

2018-10-31 Thread Tharaneedharan Vilwanathan
Thank you all for the response. Let me play with the options. Regards dharani > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googleg

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-31 Thread jake6502
It is highly likely that when go2 comes out, with generics, it will be trivial to write a ToInterfaceSlice() function that takes a slice of any type T and returns a []interface{}. On Tuesday, October 30, 2018 at 8:35:39 PM UTC-4, Justin Israel wrote: > > > > On Wed, Oct 31, 2018 at 1:32 PM robe

[go-nuts] Re: One-liner README instructions for GitHub cross compiled binary assets

2018-10-31 Thread komuW
TJ's https://github.com/apex/up uses https://github.com/goreleaser/godownloader to generate `curl bash` style downloads. On Wednesday, 31 October 2018 00:28:17 UTC+3, Paul Jolly wrote: > > Hi - I'm hoping someone can point me towards a "best practice" example on > adding binary assets to GitH

[go-nuts] [ANN] GopherCon Israel Call for Papers is Open

2018-10-31 Thread Miki Tebeka
Hello Gophers, GopherCon Israel CFP is open. Head over to https://www.papercall.io/cfps/1422/submissions/new and submit your talk. If you're not sure, ping me and I'll convince you to submit :) Please help us spread the word. - https://www.gophercon.org.il/ - https://t

[go-nuts] Re: Correct way to solve slice of interface type problem

2018-10-31 Thread Henry
Hi, You would need to manually convert []implementation to []data. See https://play.golang.org/p/DdC8sEGi75- On Wednesday, October 31, 2018 at 5:21:29 AM UTC+7, Yuri Shafet wrote: > > Hello, everyone. > Consider following code: > > package main > import "fmt" > > type implementation struct { >