Re: [go-nuts] Alternative way of setting cgocheck=0

2017-11-15 Thread Ian Lance Taylor
On Wed, Nov 15, 2017 at 9:03 PM, 'SrimanthG' via golang-nuts wrote: > > Is there any programmatic way of disabling cgo runtime checks? > > The documentation says to set environment variable "GODEBUG=cgocheck=0". > However, this does not work for me as I do not control the environment. > Hoping the

[go-nuts] Alternative way of setting cgocheck=0

2017-11-15 Thread 'SrimanthG' via golang-nuts
Hello, Is there any programmatic way of disabling cgo runtime checks? The documentation says to set environment variable "GODEBUG=cgocheck=0". However, this does not work for me as I do not control the environment. Hoping there is a programmatic way for disabling the runtime checks? Regards, Sr

[go-nuts] Re: golang and http2

2017-11-15 Thread Sanjay
I suggest just using a self-signed cert for your LB<->appserver and disabling cert-checking in your LB. Should be relatively straightforward; you can even have your appserver generate a cert on startup, so there's less messing around with files required. It'll give you http2, and also cheaply p

Re: [go-nuts] Re: golang and http2

2017-11-15 Thread Josh Humphries
One serious potential issue is that the URL scheme is still "http" (or "https") for both. With TLS, the client and server can negotiate an on-the-wire protocol using ALPN. This allows client and server to decide on HTTP 1.1 or http/2 based on what they support. But over plain-text, there is no suc

Re: [go-nuts] Re: golang and http2

2017-11-15 Thread 'Anmol Sethi' via golang-nuts
It’s really easy to do, see https://github.com/nhooyr/lily/blob/fb72112455ade17f36ed773d87902bb5eefe051e/lily.go#L82-L109 The only disadvantage is that you will not have graceful shutdown. > On Nov

[go-nuts] Re: golang and http2

2017-11-15 Thread Albert Tedja
Thank you for the links. I am still somewhat disappointed that the http/2 protocol would enforce a certain configuration. I understand the necessity of secure connections, but that's should be left as an option to the developers. If browsers want to strictly use TLS, that's fine because it's co

[go-nuts] Re: golang and http2

2017-11-15 Thread howardcshaw
See https://github.com/golang/go/issues/14141 - for discussion of the issue; and https://github.com/hkwi/h2c for a way to use the in stdlib-but-not-linked-together support for h2c (http/2 over non-TLS). Howard -- You received this message because you are subscribed to the Google Groups "gola

Re: [go-nuts] How to optimize?

2017-11-15 Thread Jan Mercl
On Wed, Nov 15, 2017 at 8:45 PM Christian LeMoussel wrote: > Why not but I don't understand. Neither do I understand, unfortunately. Additionally, the unreadable, low-contrast picture is, well, unreadable for me. Link to the playground version is perfect. Plain, black on white text without any

[go-nuts] Re: How to optimize?

2017-11-15 Thread Christian LeMoussel
. . 83:LoopSearch: 20ms 20ms 84: for i = 0; i < lenBufferHexHash; i++ { 90ms 90ms 85: hhi0, hhi1 := bufferHexHash[i], bufferHexHash[i+1] 390ms 390ms 86: for j = 0; j < lenBufferHexSearch; j++ { 710ms

[go-nuts] Re: How to optimize?

2017-11-15 Thread Christian LeMoussel
this has a little improved performance BenchmarkFindHex-2 200 954 ns/op 0 B/op 0 allocs/op BenchmarkFindHexOpti-2 200 *759 ns/op* 0 B/op 0 allocs/op Le mercredi 15 novembre 2017 19:13:15 U

Re: [go-nuts] How to optimize?

2017-11-15 Thread Christian LeMoussel
@Jan, Why not but I don't understand. Because if I do startTime = time.Now() for i := 0; i < 1000; i++ { result = bytes.Index([]byte(hash), []byte(toSearch)) != -1 } fmt.Printf("bytes.Contains Find: %t Time : %.2f sec.\n", result, time.Now().Sub(st

Re: [go-nuts] How to optimize?

2017-11-15 Thread Jan Mercl
On Wed, Nov 15, 2017 at 6:15 PM Christian LeMoussel wrote: > I have this program (https://play.golang.org/p/qHPzjj2uj3) that take a decent amount of time for computing. Don't know where to start. Maybe this one: It passes ~1GB of data by value on the stack for no reason. (Unless the compiler is

[go-nuts] Re: How to optimize?

2017-11-15 Thread Tamás Gulácsi
Help the compiler and put everything that can be looked up beforehand into a separate variable: hhi0, hhi1 := bufferHexHash[i], bufferHexHash[i+1] for j = 0; j < lenBufferHexSearch; j++ { hsj0, hsj1 := bufferHexSearch[j][0], bufferHexSearch[j][1]

[go-nuts] Re: How to optimize?

2017-11-15 Thread Christian LeMoussel
I created benchmarks : https://play.golang.org/p/kgBsciRbpe BenchmarkByteIndex-2 500 210 ns/op 64 B/op 1 allocs/op BenchmarkByteIndexPointeur-2200090.1 ns/op 0 B/op 0 allocs/op BenchmarkFindByte-2

[go-nuts] How to optimize?

2017-11-15 Thread Christian LeMoussel
Hi, I have this program (https://play.golang.org/p/qHPzjj2uj3) that take a decent amount of time for computing. Let’s open pprof and see what it spent its time on. Type: cpu Time: Nov 15, 2017 at 5:48pm (CET) Duration: 9.92s, Total samples = 9.78s (98.54%) Entering interactive mode (type "help"

[go-nuts] Parsing OpenSSH ed25519 private keys

2017-11-15 Thread Chandru
Can x/crypto/ssh parse OpenSSH's ed25519 private key files? ParseRawPrivateKeyWithPassphrase returns "ssh: cannot decode encrypted private keys" as error. -- Chandra Sekar.S -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from th

[go-nuts] Autocert renew with same private key, is possible?

2017-11-15 Thread Lucas Rodrigues
The Autocert seem to create a new certificate from `rand` instead of use the same private key already existent. It seems to be the same behavior of the Certbot

[go-nuts] Re: How to mock things without having too big an impact on the source code?

2017-11-15 Thread Glen Huang
Great tips. Thank you. On Wednesday, November 15, 2017 at 12:46:39 PM UTC+8, M P r a d e s wrote: > > Since functions are values you can just do that: > > > var NewExternalService func()Service = pkg.NewExternalService > > > and then mock NewExternalService > > or explicitely inject dependencies

Re: [go-nuts] How can interfaces be comparable and at the same time functions not?

2017-11-15 Thread Konstantin Khomoutov
On Mon, Nov 13, 2017 at 03:45:52AM -0800, 'Stephan Schweitzer' via golang-nuts wrote: [...] > I do not propose that functions should be comparable. My questions are: > >- Why are interfaces comparable by default? >- Why is it not possible to mark an interface as comparable resp. not >