[go-nuts] Concurrent map error in net/http/trasport

2016-11-10 Thread James Pettyjohn
I ran into this on go 1.6.2 amd64, seems unlikely this is a core issue and I need to look else where in the project but has anyone seen this before? fatal error: concurrent map read and map write goroutine 21619 [running]: runtime.throw(0xfefc00, 0x21) /usr/local/go/src/runtime/panic.go:

[go-nuts] [ANN] SCL, a language that extends the Hashicorp Configuration Language in the same sort of way Sass extends CSS

2016-11-10 Thread Paul M Fox
GitHub repo: https://github.com/homemade/scl Language reference: https://github.com/homemade/scl/wiki GoDoc: https://godoc.org/github.com/homemade/scl The Sepia Configuration Language is a simple, declarative, semi-functional, self-documenting language that extends HashiCorp's HCL

[go-nuts] Re: [ANN] SCL, a language that extends the Hashicorp Configuration Language in the same sort of way Sass extends CSS

2016-11-10 Thread mhhcbon
seems a great idea to bring a factorized version of this sort of solution. On Thursday, November 10, 2016 at 10:32:13 AM UTC+1, Paul M Fox wrote: > > > > GitHub repo: https://github.com/homemade/scl > Language reference: https://github.com/homemade/scl/wiki > GoDoc: https://godoc.org/github.com/ho

[go-nuts] Re: Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread nova6112
try{ byte[] imageBytes=mymultipart imagefile; httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = GsonFactory.getDefaultInstance(); Vision.Builder builder = new Vision.Builder(httpTransport, jsonFactory, null); builder.setVisionRequestIni

[go-nuts] go generate "pipelines"

2016-11-10 Thread Paul Jolly
Hi - wondering whether anyone knows of any tooling that helps with "pipelines" (probably not a great choice of phrase) of go generate-able code. Specifically the case where the output of one go generate program is code which is itself go generate-able (and hence requires another invocation of

[go-nuts] JSON parser

2016-11-10 Thread Simon Ritchie
I'm also not sure what you are trying to do. However, I think I can see a bug in your code. First you run a database query to get a list of values from a field called data. This could produce up to 10 values. Next you have a loop which runs through the values and discards them. At the end o

[go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendoerfer
Hi all, while working on instrumenting my application, I ran into the fact that capturing metrics such as status codes from my own http.Handlers is surprisingly difficult to get right. Therefor I created a package that hopefully avoids most of the common pitfalls. https://github.com/felixge/

Re: [go-nuts] why "iota"?

2016-11-10 Thread Konstantin Khomoutov
On Thu, 10 Nov 2016 10:27:49 +1030 Dan Kortschak wrote: > On Wed, 2016-11-09 at 09:30 -0500, Marvin Renich wrote: > > Iota is pronounced eye-OH-tuh. > > Or yoh-ta (like Yoda, but with s/d/t/) if not in America. > I concur that here in Russia we taught to spell it yoh-ta on our math high school c

Re: [go-nuts] Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread Pietro Gagliardi
And what's the code on the client side, which I assume is in Go? > On Nov 10, 2016, at 5:26 AM, nova6...@gmail.com wrote: > > try{ > byte[] imageBytes=mymultipart imagefile; > > httpTransport = GoogleNetHttpTransport.newTrustedTransport(); > JsonFactory jsonFactory = GsonFactory.getDe

[go-nuts] Re: Implementation status of database/sql changes

2016-11-10 Thread Viktor Kojouharov
I think it's the job of database/sql to extract any placeholders from the sql string and present them in a standardized way to each driver. It would be pointless if they had to reinvent the wheel every time. As for actually parsing SQL, it's not overly difficult. Obviously, search and replace is

[go-nuts] Re: Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread nova6112
Java language it is Web application On Wednesday, November 9, 2016 at 6:56:03 PM UTC+5:30, nova...@gmail.com wrote: > > Hi i am using Google Cloud vision API in my server side (JAVA) but when no > results found my server got crashed not sure why it is happening could > anyone help me? > > T

Re: [go-nuts] Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread nova6112
Java... it is web application... On Thursday, November 10, 2016 at 6:13:56 PM UTC+5:30, Pietro Gagliardi (andlabs) wrote: > > And what's the code on the client side, which I assume is in Go? > > On Nov 10, 2016, at 5:26 AM, nova...@gmail.com wrote: > > try{ > byte[] imageBytes=mymultipart im

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 11:09 AM, Felix Geisendoerfer wrote: > I would love for net/http experts to take a look at the "Why this > package exists" section of the README, as well as the horrible hack > required to make things work: > > https://github.com/felixge/httpsnoop/blob/master/wrap.go#L44-L

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-10 Thread alb . donizetti
When you do a DIV r32 in 64bit mode the result will be saved in EAX but this means that you can only do that if the high word of the dividend is smaller that the divisor. You can't unconditionally replace uint32(A / uint64(B)) with a DIV r32 instruction because if A is big (take 2**62) and B is

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-10 Thread radu
I don't understand. We are truncating the result to 32-bits either way. What's the point of computing the entire 64-bits of the result just to throw away the high 32? In your example, A=2^62 and B=13`, `uint32(A / uint64(B))` is (2^62 / 13) % 2^32 which I thought is exactly the result of DIV r3

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-10 Thread alb . donizetti
If the div overflow, it will trigger and hardware exception. Il giorno giovedì 10 novembre 2016 15:01:06 UTC+1, ra...@cockroachlabs.com ha scritto: > > I don't understand. We are truncating the result to 32-bits either way. > What's the point of computing the entire 64-bits of the result just t

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
Yes, I thought about it :). Did you read the "Why this package exists” section of the README? The problem with this approach is that an application’s behavior might change merely because the method is present. E.g. imagine an application doing this: ``` _, ok := w.(http.Flusher) if ok { w.Wri

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 02:21 PM, Felix Geisendörfer wrote: > Yes, I thought about it :). > > Did you read the "Why this package exists” section of the README? Yes but obviously not closely enough :) Kubernetes takes a hybrid approach: https://github.com/kubernetes/kubernetes/blob/master/pkg/a

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-10 Thread radu
Ah, I missed that, thanks! On Thursday, November 10, 2016 at 9:05:53 AM UTC-5, alb.do...@gmail.com wrote: > > If the div overflow, it will trigger and hardware exception. > > Il giorno giovedì 10 novembre 2016 15:01:06 UTC+1, ra...@cockroachlabs.com > ha scritto: >> >> I don't understand. We ar

[go-nuts] premature defer in method when using cgo

2016-11-10 Thread iakov . davydov
Hi, I don't have a minimal example yet, but this looks very suspicious. It seems that sometimes defer called before the function finishes, if cgo code with callbacks is called in it. Here's the code: func (n *NLOPT) Run(iterations int) { log.Debug("entering Run method") ...

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
There are a few problems with the Kubernetes implementation. The first thing I noticed is that they seem to have copied their code from the prometheus go client: https://github.com/prometheus/client_golang/blob/master/prometheus/http.go#L289

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-10 Thread Michael Jones
A=2^62 B=13 A/B = 4611686018427387904/13 A/B = quotient 354745078340568300 with remainder 4 A/B = (82595524*2^32 + 3964585196) with remainder 4 Consider the quotient: H = Upper 32 bits of 354745078340568300 = 82595524 L = Lower 32 bits of 354745078340568300 = 3964585196 Apparently

Re: [go-nuts] why "iota"?

2016-11-10 Thread Michael Jones
“…on our math high school courses.” Which I imagine are like my college math courses! -Original Message- From: on behalf of Konstantin Khomoutov Date: Thursday, November 10, 2016 at 4:09 AM To: Dan Kortschak Cc: Marvin Renich , golang-nuts Subject: Re: [go-nuts] why "iota"? On

Re: [go-nuts] why "iota"?

2016-11-10 Thread Rob Pike
You had math in high school? -rob On Thu, Nov 10, 2016 at 6:43 AM, Michael Jones wrote: > “…on our math high school courses.” > > Which I imagine are like my college math courses! > > > -Original Message- > From: on behalf of Konstantin Khomoutov < > flatw...@users.sourceforge.net> >

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
Out of interest, do you have any examples of packages that perform a type check to reject an operation with a response writer? Your implementation is complex purely to address this scenario. I would think that 99+% of all type checks are to determine whether the supplied object provides additional

Re: [go-nuts] go generate "pipelines"

2016-11-10 Thread Rob Pike
Offhand: You would need to write the programs go generate is calling to be idempotent, and have the second one exit quietly if the first hasn't run. You would then either run go generate twice or have the first program run go generate once it had completed. Not pretty but it does seem like a rare

[go-nuts] Re: go generate "pipelines"

2016-11-10 Thread Tieson Molly
Not exactly, but I was looking at goa, and the goagen generates some code that you can then run go generate against. On Thursday, November 10, 2016 at 5:37:39 AM UTC-5, Paul Jolly wrote: > > Hi - wondering whether anyone knows of any tooling that helps with > "pipelines" (probably not a great ch

Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread Jan Mercl
On Thu, Nov 10, 2016 at 3:31 PM wrote: > So defer is executed before the method exits. Does log.Debug flush its output before returning? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
> On 10 Nov 2016, at 15:59, Ian Davis wrote: > > Out of interest, do you have any examples of packages that perform a type > check to reject an operation with a response writer? Your implementation is > complex purely to address this scenario. No, that was a bogus example. However, I do have

Re: [go-nuts] why "iota"?

2016-11-10 Thread Konstantin Khomoutov
On Thu, 10 Nov 2016 06:43:09 -0800 Michael Jones wrote: > “…on our math high school courses.” > > Which I imagine are like my college math courses! Oh, yes, I meant college; silly me ;-) The problem is that we have somewhat incompatible denominations for these education-related terms, and wha

[go-nuts] Re: JSON parser

2016-11-10 Thread Sergio Hunter
Thanks so much for your answer. I'll try to explain what I need. I have a field "data",inside field has compress rows and text data(json), I need decompress data, but my code begins to unpack the file to text and compiler generates an error. The logic is this: It reads "data" of the database, do

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Ian Davis
On Thu, Nov 10, 2016, at 03:21 PM, Felix Geisendörfer wrote: > >> I would think that 99+% of all type checks are to determine whether >> the supplied object provides additional functionality that can be >> used. I'm struggling to think of a situation where you would type >> check for the Flush meth

[go-nuts] Go regexp replace missing functionalities?

2016-11-10 Thread Tong Sun
While trying to solve the following problem, it seems that Go regexp replacement is missing an important functionality -- able to do full-fledged replacing with user defined functions. - I know that "ReplaceAllStringFunc" is designed to do that, however, it is missing an important aspect of regexp

Re: [go-nuts] why "iota"?

2016-11-10 Thread Michael Jones
…I was not correcting you. I was saying that the whole world appreciates the strength of Russian math education as consistently demonstrated in the International Mathematical Olympiad. (This is the Olympics that excites me, the place for people who can wrestle with exponential generating functio

[go-nuts] Re: Concurrent map error in net/http/trasport

2016-11-10 Thread adonovan via golang-nuts
On Thursday, 10 November 2016 04:09:29 UTC-5, James Pettyjohn wrote: > > I ran into this on go 1.6.2 amd64, seems unlikely this is a core issue and > I need to look else where in the project but has anyone seen this before? > > fatal error: concurrent map read and map write > > goroutine 21619 [ru

[go-nuts] Re: JSON parser

2016-11-10 Thread pierre . curto
Ok, then something along those lines: https://play.golang.org/p/dMPQIrEdNN Le jeudi 10 novembre 2016 16:36:21 UTC+1, Sergio Hunter a écrit : > > Thanks so much for your answer. > I'll try to explain what I need. I have a field "data",inside field has > compress rows and text data(json), I need d

[go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Tong Sun
That's very interesting Felix. Can it handle https requests as well? On Thursday, November 10, 2016 at 6:09:32 AM UTC-5, Felix Geisendoerfer wrote: > > Hi all, > > while working on instrumenting my application, I ran into the fact that > capturing metrics such as status codes from my own http.

Re: [go-nuts] [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
> On 10 Nov 2016, at 16:44, Ian Davis wrote: > > You can't in the general case. You cover the interfaces that you currently > know about but you don't know what other interfaces people are relying on. > Sipporting those becomes a combinatorial problem of whack-a-mole. I think Go 1.7 allows fo

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
Hi Tong, the README example shows logging request related information (method, url) in addition to the response related stuff. Most of the request related information is easy to get directly from the request object, so I didn’t implement any special support for that yet. That being said, I cou

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
Tong, I may have misread your e-mail. I missed the “s” in http(s). I don’t see anything that would be special about http requests, so they should just work. Cheers Felix > On 10 Nov 2016, at 17:02, Felix Geisendörfer wrote: > > Hi Tong, > > the README example shows logging request related in

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Tong Sun
Yep, that's what I meant. Thanks. On Thu, Nov 10, 2016 at 11:04 AM, Felix Geisendörfer wrote: > Tong, I may have misread your e-mail. I missed the “s” in http(s). > > I don’t see anything that would be special about http requests, so they > should just work. > > Cheers > Felix > > On 10 Nov 2016

[go-nuts] Re: JSON parser

2016-11-10 Thread Sergio Hunter
The compiler generates an error Test.go:71: undefined: o Test.go:85: cannot use nil as type Object in return argument четверг, 10 ноября 2016 г., 17:56:58 UTC+2 пользователь pierre...@gmail.com написал: > > Ok, then something along those lines: > https://play.golang.org/p/dMPQIrEdNN > > Le j

Re: [go-nuts] go generate "pipelines"

2016-11-10 Thread Pietro Gagliardi
Why not just run all those generate commands in a single go generate call, such as a shell script or a go run? > On Nov 10, 2016, at 9:53 AM, Rob Pike wrote: > > Offhand: > > You would need to write the programs go generate is calling to be idempotent, > and have the second one exit quietly if

Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread Ian Lance Taylor
On Thu, Nov 10, 2016 at 3:18 AM, wrote: > > I don't have a minimal example yet, but this looks very suspicious. It seems > that sometimes defer called before the function finishes, if cgo code with > callbacks is called in it. > > Here's the code: > > func (n *NLOPT) Run(iterations int) { >

Re: [go-nuts] premature defer in method when using cgo

2016-11-10 Thread iakov . davydov
Hi, As far as I understand, os.Stdout & os.Stderr are not buffered. log.Debug writes to stderr. I replaced log.Debug with println, the result is the same. Cheers, Iakov P.S. Struggling with creating a minimal example; the results is not very stable. Will put it here if I will manage. On Thursda

[go-nuts] Re: JSON parser

2016-11-10 Thread pierre . curto
Sorry, I did not test it. This one passes the playground build (up to the mysql driver not being found): https://play.golang.org/p/_WfTMOd-s6 Le jeudi 10 novembre 2016 17:13:19 UTC+1, Sergio Hunter a écrit : > > The compiler generates an error > > Test.go:71: undefined: o > Test.go:85: cannot use

[go-nuts] Re: JSON parser

2016-11-10 Thread Sergio Hunter
Thanks for your help. Do you know what it means? 2016/11/10 18:46:21 invalid character '\u0085' looking for beginning of value exit status 1 четверг, 10 ноября 2016 г., 18:32:40 UTC+2 пользователь pierre...@gmail.com написал: > > Sorry, I did not test it. This one passes the playground build

[go-nuts] Re: JSON parser

2016-11-10 Thread pierre . curto
We will get there but is is hard hitting your target when shooting in the dark :). Remove white spaces: https://play.golang.org/p/_LktUPDhYW Le jeudi 10 novembre 2016 17:52:21 UTC+1, Sergio Hunter a écrit : > > Thanks for your help. > Do you know what it means? > 2016/11/10 18:46:21 invalid ch

[go-nuts] Re: premature defer in method when using cgo

2016-11-10 Thread iakov . davydov
e been violating cgo rules by passing Go pointer to an integer to the C code for storage. C.nlopt_set_max_objective(n.gopt, (C.nlopt_func)(unsafe.Pointer(C.callback_adaptor)), unsafe.Pointer(&nID)) Now I do it like this instead: C.nlopt_set_max_objective(n.gopt, (C.nlopt_func)(unsafe.Pointer(

[go-nuts] Re: JSON parser

2016-11-10 Thread Sergio Hunter
I agree with you) But what do i do with this, It's exactly the same error. четверг, 10 ноября 2016 г., 19:05:12 UTC+2 пользователь pierre...@gmail.com написал: > > We will get there but is is hard hitting your target when shooting in the > dark :). > > Remove white spaces: > https://play.golang.

[go-nuts] Re: JSON parser

2016-11-10 Thread pierre . curto
Then you need to provide sample data... Le jeudi 10 novembre 2016 18:33:10 UTC+1, Sergio Hunter a écrit : > > I agree with you) But what do i do with this, It's exactly the same error. > > четверг, 10 ноября 2016 г., 19:05:12 UTC+2 пользователь > pierre...@gmail.com написал: >> >> We will get the

[go-nuts] Pure golang library to encode N-Quads

2016-11-10 Thread Johann Höchtl
Is there any? I found https://github.com/Callidon/joseki which doesn't seem to support N-Quads and https://github.com/knakk/rdf seems to be incapable to serialize N-Quads. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from th

[go-nuts] Re: postgres example using lib/pq

2016-11-10 Thread arbingersys
Here's a nice succinct example http://albertech.blogspot.com/2016/10/minimal-sql-select-example-for-go-and.html On Wednesday, August 21, 2013 at 7:59:08 AM UTC-6, will wrote: > > Hi, > Can someone give me a basic example of pulling data from a postgres > database e.g. mydatabase for two parame

[go-nuts] Re: JSON parser

2016-11-10 Thread Sergio Hunter
I can't because аccess to the database is only granted to me. If leave my code and only add code which would be skip text rows and continues to unpack the archive? четверг, 10 ноября 2016 г., 19:34:33 UTC+2 пользователь pierre...@gmail.com написал: > > Then you need to provide sample data... >

[go-nuts] [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-10 Thread the_recipe
Hey everyone, I would like to officially announce the project I'm working on for a while now. It's a binding for the Qt framework + some tools to help you with development and deployment of your Qt applications. The most interesting feature of the Qt framework for the Go community is probably

Re: [go-nuts] Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread Dave Cheney
Thanks for your reply. I'm not sure we can help you, this is a mailing list about the Go programming language. -- 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 g

[go-nuts] question on profiling and instruction count display

2016-11-10 Thread Tieson Molly
Is there a way to use the native pprof tool to display the instruction count based on the sample instead of the duration for a cpu profile? I saw this post on SO, but I was hoping to be able to use pprof and not a 3rd party tool http://stackoverflow.com/questions/28924550/golang-profile-with-pp

[go-nuts] question on profiling and instruction count display

2016-11-10 Thread Dave Cheney
I'm afraid not, pprof does not record that information. -- 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 options

[go-nuts] Re: [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-10 Thread Rusco
Good to see some progress on the GUI front - I think you are up to something ! Rusco On Thursday, 10 November 2016 20:34:36 UTC, therecipe wrote: > > Hey everyone, > > I would like to officially announce the project I'm working on for a while > now. > It's a binding for the Qt framework + some

[go-nuts] Re: Tried to create a Varnish VMOD in go, but got "undefined reference" link errors

2016-11-10 Thread cristiantav
Did you find a way to get this to work? On Saturday, October 24, 2015 at 9:09:51 PM UTC-4, Hiroaki Nakamura wrote: > > Hi. > > I tried to create an Varnish VMOD equivalent to > https://github.com/varnish/libvmod-example/tree/4.1 in go, > but I got "undefined reference" link errors. > > ``` > gcc

[go-nuts] rewriting html/template files

2016-11-10 Thread 'Jeff Hodges' via golang-nuts
I originally wrote this up as a GitHub issue, but I want to make sure I'm not missing anything by emailing this list first. It would be nice if it was easier to rewrite `html/template` files but the current tools (`html/template` and `x/net/html`) seem to have a gap between them. Maybe there's a w

[go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Hirotaka Yamamoto (ymmt2005)
Hi, I had implemented and blogged the technique to properly wrap http.ResponseWriter: http://ymmt2005.hatenablog.com/entry/2016/09/01/How_to_hack_Go%27s_http_Server_correctly type StdResponseWriter interface { http.ResponseWriter io.ReaderFrom http.Flusher http.CloseNotifier http.Hijacker WriteS

[go-nuts] Sub-Benchmark strange results.

2016-11-10 Thread Evan Digby
Is it expected that if multiple sub-benchmarks are run in the same benchmark, the cost of the setup will impact the results from the first benchmark but not the second? func BenchmarkIntersection(b *testing.B) { // Long setup -- ~5.5 seconds b.Run("basic 1", func(b *testing.B) { for i :

[go-nuts] Re: Sub-Benchmark strange results.

2016-11-10 Thread Dave Cheney
Can you post a runable sample so that other can try to reproduce your issue? On Friday, 11 November 2016 12:06:21 UTC+11, Evan Digby wrote: > > Is it expected that if multiple sub-benchmarks are run in the same > benchmark, the cost of the setup will impact the results from the first > benchmark

[go-nuts] Re: Sub-Benchmark strange results.

2016-11-10 Thread Evan Digby
I'm actually struggling to come up with a toy example that identically reproduces the results. I wonder if there are some compiler optimizations happening here. The example isn't a lot of source, but has some IP and code that's not exactly in a state I wish to post publicly (rough draft). Is th

[go-nuts] Re: Sub-Benchmark strange results.

2016-11-10 Thread Evan Digby
On a second glance, there's no real IP here. Let's not complicate things--I just ask that nobody judge the state of this code, unless that state is the reason for the strange benchmark results! This won't run in playground since it's a benchmark, but provided as a nicer place to paste: https:/

Re: [go-nuts] How to conv [3]int to []int ?

2016-11-10 Thread Dan Kortschak
They have different layouts in memory. Do you just want to do this: package main import ( "fmt" ) func main() { a := [3]int{1, 2, 3} b := a[:] fmt.Println(b) } https://play.golang.org/p/OBY7g3azBE If so, there's no need for unsafe. If not, what are you trying to

[go-nuts] How to conv [3]int to []int ?

2016-11-10 Thread steve tang
Hi theres, I used unsafe.Pointer to conv Type [3]int to Type []int, But it throws a runtime error, Could anybody tell me why? many thanks. The test code is as follows: package main import ( "fmt" "unsafe" ) func main() { a := [3]int{1, 2, 3} b := *(*[]int)(unsafe.Pointer(&a)) fmt.Print

[go-nuts] Re: JSON parser

2016-11-10 Thread Tamás Gulácsi
2016. november 10., csütörtök 21:20:46 UTC+1 időpontban Sergio Hunter a következőt írta: > > I can't because аccess to the database is only granted to me. > If leave my code and only add code which would be skip text rows and > continues to unpack the archive? > > We haven't asked for access to t

[go-nuts] Concurrency and order of execution

2016-11-10 Thread mspaulding06
Hello, I've written a small program to demonstrate what I am seeing. If I use a channel as a semaphore and set the size of the channel to 1, I would expect that the executions of my handle function below would all be executed in order, but it's not. For some reason the last item in the list i

Re: [go-nuts] Concurrency and order of execution

2016-11-10 Thread Henrik Johansson
I think there is a race on the WaitGroup. Add all of them before the loop. It might not matter for what you are seeing but anyway. What happens with an unbuffered channel? On Fri, Nov 11, 2016, 07:08 wrote: > Hello, > > I've written a small program to demonstrate what I am seeing. If I use a >

Re: [go-nuts] Concurrency and order of execution

2016-11-10 Thread Henrik Johansson
Also what makes you think that ordering is mandated? Any of the goroutines can be scheduled to run. The odds of 1 running first seems intuitively higher but the should be nothing stopping the last to run first. On Fri, Nov 11, 2016, 07:11 Henrik Johansson wrote: > I think there is a race on the

Re: [go-nuts] Concurrency and order of execution

2016-11-10 Thread Ian Lance Taylor
On Thu, Nov 10, 2016 at 10:03 PM, wrote: > > I've written a small program to demonstrate what I am seeing. If I use a > channel as a semaphore and set the size of the channel to 1, I would expect > that the executions of my handle function below would all be executed in > order, but it's not. F

[go-nuts] Re: Concurrency and order of execution

2016-11-10 Thread Dave Cheney
The runtime does not give any guarentee when you use a go statement if the goroutine being spawned will run immediately, or if control will remain with the original goroutine. This program, https://play.golang.org/p/-OcCzgt4Jy, which pauses all goroutines while they are being created exhibits

Re: [go-nuts] Re: [ANN] httpsnoop, an easy way to capture http related metrics (response time, bytes written, and http status code)

2016-11-10 Thread Felix Geisendörfer
> I think an interface like this should be provided in net/http package to > make it easy to capture the response. Yeah, I was hoping the new http tracing stuff would allow for this kind of instrumentation, but unfortunately it’s targeted at different aspects of the request/response cycle. Chee

Re: [go-nuts] How to conv [3]int to []int ?

2016-11-10 Thread steve tang
Thanks, But I want them hold same data addrs. So I just changed your code to follows: a := [3]int{1, 2, 3} b := (&a)[:] On Friday, November 11, 2016 at 1:55:06 PM UTC+8, kortschak wrote: > > They have different layouts in memory. Do you just want to do this: > > package main > > import ( >