Re: [go-nuts] Conditional compiling for android

2018-02-01 Thread aashish . a . patel
Thanks for getting back. I finally got it to work after some experimentation on test project. Solution Added tag android for android only file and named it with suffix _android // +build android And for linux only file added // +build !android Below env are set as mentioned earlier GOOS=android

[go-nuts] Re: A small library for transactions with accounts

2018-02-01 Thread matthewjuran
> > Transaction can give an error for different reasons, and I want to give > the client a wide choice. Probably, the financial features are to blame for > this ... I agree with having switchable errors but usually this is done with vars of types that implement the error interface. For exampl

[go-nuts] [ANN] etcd v3.3.0

2018-02-01 Thread Gyuho Lee
Hi Go users! We've just released etcd v3.3.0 with blog post . etcd is consistent distributed key-value store, mainly used as a separate coordination service. It's written in Go and uses gRPC for it

Re: [go-nuts] Conditional compiling for android

2018-02-01 Thread Hyang-Ah Hana Kim
Partly true. Build tags like !android should prevent inclusion of the file. Files named with _android suffix or with android buildtag should be included only for android. https://go.googlesource.com/go/+/master/src/time/zoneinfo_android.go https://go.googlesource.com/go/+/master/src/time/zoneinfo_

[go-nuts] Re: A small library for transactions with accounts

2018-02-01 Thread e . sesigin
Matt, thank you, you took the time to review my code, I appreciate it. Usually on GitHub the license is in LICENSE, not LICENSE.md . Yes, added .md by analogy with README.md core_public.go, transaction_public.go could just be core.go and transaction.go

[go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread marwan . sulaiman
I usually wrap the function call with `if false` i.e: if false { package.Function() } This "comments out" the function call and keeps the package imported. On Thursday, February 1, 2018 at 12:00:23 PM UTC-5, Alex Buchanan wrote: > > Clever workarounds! > > These solutions don't handle the c

Re: [go-nuts] How to seed rand module in playground?

2018-02-01 Thread asohn . unique
this maze script is pretty cool, i like things like this when learning a new language. as a challenge to myself, i wrote a maze solver in the script. - it uses bash color codes to highlight the solution if highlight_solution is true On Thursday, September 13, 2012 at 12:26:52 PM UTC-5, Kyle Le

Re: [go-nuts] How to seed rand module in playground?

2018-02-01 Thread asohn . unique
forgot to add the link https://play.golang.org/p/oz6wmWueJcg for the maze solver On Thursday, September 13, 2012 at 12:26:52 PM UTC-5, Kyle Lemons wrote: > > On Wed, Sep 12, 2012 at 5:07 PM, Yaşar Arabacı > wrote: > >> I did random maze generator today. playground is nice for quickly >> showing

[go-nuts] [security] Go 1.8.7 and Go 1.9.4 pre-announcement

2018-02-01 Thread Andrew Bonventre
Hello gophers, We plan to issue Go 1.8.7 and Go 1.9.4 on Wednesday, February 7 at approximately 8pm UTC (12pm PST, 3pm EST). These are minor releases to fix a security issue. Following our policy at https://golang.org/security, this is the pre-announcement of those releases. Cheers, Andy on beha

Re: [go-nuts] Conditional compiling for android

2018-02-01 Thread Dave Cheney
The build system considers android and Linux to be the same for historical reasons. -- 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...@goog

Re: [go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-02-01 Thread 'Axel Wagner' via golang-nuts
I don't really see the difference in writing func Less(a, b *T) bool and func (a *T) Less(b *T) bool convenience wise - except that the latter requires the name to be exported and doesn't allow using a function literal (so, yeah, the latter actually seems significantly *less* convenient). On Thu,

Re: [go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-02-01 Thread Chris Hopkins
No, was hoping to use the interface (It's the only reason I defined it) to test if two items are equal. I guess I could enforce that you have to supply the equals function like the sort interface does. I was just hoping for more. I'll have a rethink next time I have time. Thanks On Thursday, 1

[go-nuts] Re: public key in pem file to X509.Certificate?

2018-02-01 Thread Tad Vizbaras
Found it. The key is to use function x509.ParseCertificate(block.Bytes) . Code below is not clean but should help anyone looking for a way to parse pem file into x509.Certificate. f, err := os.Open(sn.recpCertFile) if err != nil { log.Fatal(err) } defer f.Close() pubPEM, err := ioutil.ReadAll(f

Re: [go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-02-01 Thread 'Axel Wagner' via golang-nuts
On Thu, Feb 1, 2018 at 11:52 AM, Chris Hopkins wrote: > Yeah, so having played with this. It seems that this is going to take some > judicious use of reflect if I'm to stand any chance of maintaining a > flexible API, which I really hoped to avoid. > I'm 99% sure that you don't have to use refle

[go-nuts] Re: Go 1.10 release candidate 1 is released

2018-02-01 Thread luisalvaradox
I will probably GO NUTS about this release. On Thursday, January 25, 2018 at 3:26:42 PM UTC-6, Andrew Bonventre wrote: > > Hello gophers, > > We have just released go1.10rc1, a release candidate of Go 1.10. > It is cut from release-branch.go1.10 at the revision tagged go1.10rc1. > > Thank you t

Re: [go-nuts] Conditional compiling for android

2018-02-01 Thread Hyang-Ah Hana Kim
Strange. Can you share an example for repro? On Thu, Feb 1, 2018 at 7:07 AM, wrote: > I have similar situation where I need to compile a package specifically > for android and other specifically for linux. > I have included constraints mentioned above for pure linux and pure > android compilatio

[go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread Alex Buchanan
Clever workarounds! These solutions don't handle the case of commenting out a function call, which is a common need IMO. Whatever the workaround, it would still be easier if done by vet, right? On Wednesday, January 31, 2018 at 6:46:40 PM UTC-8, Alex Buchanan wrote: > > Unused variables and imp

Re: [go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread louist87
I have my editor set up to hilight "// DEBUG", so I tend to do: > _ = foo // DEBUG Problem solved. :) On Thursday, February 1, 2018 at 3:34:07 PM UTC, Jan Mercl wrote: > > On Thu, Feb 1, 2018 at 4:26 PM > wrote: > > > You can also use _ to store unused variables. Like this: > > That works, but I

Re: [go-nuts] Deploying protobuf code on AppEngine standard

2018-02-01 Thread Josh Humphries
If the external packages can be located via your GOPATH, then `gcloud app deploy` should also be able to find the code and compile+deploy the app. You could also vendor the external packages (so they appear under a "vendor" folder in the same directory as your app's entry point and the rest of your

[go-nuts] Re: public key in pem file to X509.Certificate?

2018-02-01 Thread Tad Vizbaras
Note: I know how to get to *rsa.PublicKey from pem file. Probably missing something really obvious. On Thursday, February 1, 2018 at 11:07:38 AM UTC-5, Tad Vizbaras wrote: > > How to get X509.Certificate struct from public key in pem file? > > -- You received this message because you are subscr

Re: [go-nuts] Documentation issue on the Getting Started page

2018-02-01 Thread Ian Lance Taylor
On Thu, Feb 1, 2018 at 8:07 AM, Amedee Van Gasse wrote: > > On Thursday, February 1, 2018 at 4:59:32 PM UTC+1, Ian Lance Taylor wrote: >> >> On Thu, Feb 1, 2018 at 7:02 AM, Amedee Van Gasse >> wrote: >> > >> > I am taking my first steps with Go and following the instructions on >> > https://golan

[go-nuts] public key in pem file to X509.Certificate?

2018-02-01 Thread Tad Vizbaras
How to get X509.Certificate struct from public key in pem file? -- 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...@googlegroups.com. For more

Re: [go-nuts] Documentation issue on the Getting Started page

2018-02-01 Thread Amedee Van Gasse
On Thursday, February 1, 2018 at 4:59:32 PM UTC+1, Ian Lance Taylor wrote: > > On Thu, Feb 1, 2018 at 7:02 AM, Amedee Van Gasse > > wrote: > > > > I am taking my first steps with Go and following the instructions on > > https://golang.org/doc/install to the letter. > > I am finding documenta

Re: [go-nuts] Documentation issue on the Getting Started page

2018-02-01 Thread Ian Lance Taylor
On Thu, Feb 1, 2018 at 7:02 AM, Amedee Van Gasse wrote: > > I am taking my first steps with Go and following the instructions on > https://golang.org/doc/install to the letter. > I am finding documentation issues that are reproducible on a clean system, I > can give exact steps to reproduce. > > T

Re: [go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread Jan Mercl
On Thu, Feb 1, 2018 at 4:26 PM wrote: > You can also use _ to store unused variables. Like this: That works, but I do not recommend to do that. The temporary '_= foo' workaround is too easy to miss and it can stay accidentaly left in production code. The earlier discussed 'use(foo)' avoids it ha

Re: [go-nuts] what is the out put of this code and why?

2018-02-01 Thread Ian Davis
If it compiled (there are syntax errors) then I'd expect it to print each of the numbers 0..99 doubled, followed by a repeat of the last printed value. Each iteration of the second loop you set y = x[i]+i What are you trying to achieve? On Thu, 1 Feb 2018, at 9:43 AM, Ganesh kumar wrote: > packa

[go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread wright . elliot
You can also use _ to store unused variables. Like this: https://play.golang.org/p/m4bWwbLYELW -- 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+unsubs

[go-nuts] Documentation issue on the Getting Started page

2018-02-01 Thread Amedee Van Gasse
I am taking my first steps with Go and following the instructions on https://golang.org/doc/install *to the letter*. I am finding documentation issues that are reproducible on a clean system, I can give exact steps to reproduce. To give one example, the documentation says: "(If you'd like to us

Re: [go-nuts] Conditional compiling for android

2018-02-01 Thread aashish . a . patel
I have similar situation where I need to compile a package specifically for android and other specifically for linux. I have included constraints mentioned above for pure linux and pure android compilation but still both files are getting built and I get error. GOOS=android GOARCH=arm Android s

[go-nuts] what is the out put of this code and why?

2018-02-01 Thread Ganesh kumar
package main import ( "fmt") func main() { var y int var x [100]int for i:=0 ; i <=99 ; i++ { x[i] = i } for i := 0 ;i <= 99; i++ { y = x[i] y += i fmt.println(y) } fmt.Print(y) } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubs

[go-nuts] An extremely fast UUID alternative, 10-135 times faster

2018-02-01 Thread edwingeng
>From time to time, we need to give something (like requests, objects, etc.) unique numbers. Timestamp and random number cannot ensure uniqueness, UUID and generating IDs with Redis are slow. Therefore, I created WUID, an extremely fast unique number generator. WUID is 10-135 times faster th

[go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-02-01 Thread matthewjuran
For issue tracker reports these questions are asked: What did you do? What did you expect to see? What did you see instead? Please describe your API needs in more detail. Interfaces are useful for API design but it appears we may be misunderstanding what your interface type assertion needs ar

[go-nuts] Re: A small library for transactions with accounts

2018-02-01 Thread matthewjuran
Hi Eduard, here’s a code review. Usually on GitHub the license is in LICENSE, not LICENSE.md. core_public.go, transaction_public.go could just be core.go and transaction.go. The Core type is a code smell to me because it doesn’t represent anything specific. Perhaps there’s a need for multiple

[go-nuts] Re: X509 pem RSA example?

2018-02-01 Thread Tad Vizbaras
I just realized that encryption and signing (optional) has to be done for S/MIME and PKCS7. Does standard library covers this? -- 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

[go-nuts] Re: X509 pem RSA example?

2018-02-01 Thread Tad Vizbaras
Very helpful. Thanks. Can I use 3DES encryption instead of sha256.New() ? Inside this call: ciphertext, err := rsa.EncryptOAEP(sha256.New(), rng, &public, secretMessage, label) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr

[go-nuts] Re: X509 pem RSA example?

2018-02-01 Thread Christian Joergensen
The public key is contained in the private key. Which can be decoded using encoding/pem and crypto/x509. Here's an example: https://gist.github.com/chrj/1d25c18882b33e78d5882fb1fd8bf693 Cheers, Christian -- You received this message because you are subscribed to the Google Groups "golang-nut

[go-nuts] X509 pem RSA example?

2018-02-01 Thread Tad Vizbaras
Looking for source code example on how to load private/public key from .pem file. Then use it to encrypt/decrypt/sign using RSA. Standard library examples are too low level. My requirement is rather basic: load pem file and then use various RSA functions. I was looking at rsa.EncryptOAEP but

[go-nuts] Deploying protobuf code on AppEngine standard

2018-02-01 Thread s2gatev
Hey there! I'm trying to convert an AppEngine flexible setup to standard environment. I hit a problem with a piece of code that depends on some protobuf definitions. The problem is that the protobuf definitions import some external packages: import google_protobuf "github.com/golang/protobuf/pty

[go-nuts] Re: GOTCHA: Just when you think you understand interfaces

2018-02-01 Thread Chris Hopkins
Yeah, so having played with this. It seems that this is going to take some judicious use of reflect if I'm to stand any chance of maintaining a flexible API, which I really hoped to avoid. I had assumed that the point of interfaces was to avoid this. I guess from a high level I don't see why a s

[go-nuts] Re: unused import and variables, necessary at compiler level? Experience can be improved?

2018-02-01 Thread Elazar Leibovich
While Jan's tip sounds a better idea, I made a small piece of code that rewrites your code AST to use every unused variable and run it temporarily: https://github.com/elazarl/gosloppy It might not work now for new Go syntax, but it worked for me in the past, and you might be able to update it.

[go-nuts] A small library for transactions with accounts

2018-02-01 Thread Claygod
Hi! I'm writing a small library for transactions with accounts. Designed for multi-thread use, and I hope it's quite productive. Link to Githab: https: //github.com/claygod/transaction I will be grateful for the feedback. -- You received this message because you are subscribed to the Google Grou

Re: [go-nuts] question

2018-02-01 Thread Jan Mercl
On Thu, Feb 1, 2018 at 8:39 AM 王晚成 wrote: '&' Expression takes the address of an addressable expression. '&' Type '{' ... '}' creates an instance of T (restrictions apply) and returns the address of the instance. -- -j -- You received this message because you are subscribed to the Google Gro

Re: [go-nuts] Re: Upcoming Go protobuf release

2018-02-01 Thread Walter Schulze
I cannot recall that I have experienced these problems. The generated code has also been far easier to maintain than the runtime reflected code that is repeatedly patched by golang/protobuf. Except for import paths, this is probably one of the easiest projects a developer will get to work on. It is