Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread as . utf8
Threads are the structural and functional loci of execution on some operating systems, data stored in a box accessible to each thread makes sense when you obey the constraint that the things in that box are to be used for that thread exclusively. Goroutines are different, they function like

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-07 Thread jianzhangbjz
But, if I can not change the C client, how to implement it? the C client as the following. As described on the above, I have to change the ` int** _levelmatrix` argument, right? bool test_settopologyresource(bsagomodule* _self, char* _nodename, int _resourceindex, char** _nameunits, int**

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-07 Thread jianzhangbjz
Thanks! As my example on the above, I have to change the C client (change `int** _levelmatrix` argument to `int* _levelmatrix`), right? 在 2017年8月7日星期一 UTC+8下午10:14:44,Konstantin Khomoutov写道: > > On Mon, Aug 07, 2017 at 06:25:48AM -0700, jianzh...@gmail.com > wrote: > > > Thank you very much

Re: [go-nuts] Offline Go Documentation Tools

2017-08-07 Thread me
On Monday, July 24, 2017 at 2:52:48 PM UTC-6, Rob 'Commander' Pike wrote: > > The "go doc" (distinct from "godoc") command works fine offline. It fact > it never goes on line. > > -rob > > That's a good tip, I might be even able to use that and pipe it into an editor Memo/Edit widget for

Re: [go-nuts] Offline Go Documentation Tools

2017-08-07 Thread me
On Monday, July 24, 2017 at 10:46:31 AM UTC-6, Tyler Compton wrote: > > For cursor-sensitive help dialogs, you may find Language Server > Protocol[1] interesting. It provides what you're looking for in Visual > Studio Code with Go today, and will help provide that functionality to > editors

Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Linker
Hi, Daniel! Do you know Goroutine local storage ? How about replace Context with the Goroutine local storage ? On Tue, Aug 8, 2017 at 12:06 AM, Daniel Theophanes wrote: > Hello Micha, > > I'm not seeing any

[go-nuts] built tests fail on sierra 10.12.6

2017-08-07 Thread Bakul Shah
How to debug these issues? $ cd /usr/local/go/src $ ./all.bash ... ok cmd/vet 2.859s ok cmd/vet/internal/cfg0.012s 2017/08/07 15:19:58 Failed: exit status 1 The same thing happens either with the HEAD branch or go1.9rc2 (and also earlier). In addition go1.9rc2 has this failure:

Re: [go-nuts] Re: How to automatically get all dependencies (even for tests)?

2017-08-07 Thread Sebastien Binet
On Mon, Aug 7, 2017 at 5:05 PM, wrote: > An easy way around this is to just import the package with an underscore > before it in your main file. I only had one test package I needed so this > worked well for me. > > i.e _"github.com/some/thing" > > On Monday, August 6, 2012

[go-nuts] Go 1.9 Release Candidate 2 is released

2017-08-07 Thread Chris Broadfoot
Hello gophers, We have just released go1.9rc2, a release candidate of Go 1.9. It is cut from release-branch.go1.9 at the revision tagged go1.9rc2. Thank you to everyone who has helped to test Go 1.9 so far. We still need more people to test, especially on production workloads. Your help is

[go-nuts] Re: Concurrency Testimonial

2017-08-07 Thread ojucie
Cecil, never mind the low response count for your testimonial. We are happy for you and feel your pleasure, believe me. Go concurrency support is really that awesome. A lot of people don't jump to respond to you just because we are used to this superb tool. Fast and easy. What amuses me the

[go-nuts] Re: runtime.GOOS case

2017-08-07 Thread Eric Brown
Appreciate the reply, guys. Also, Chris, it's not usually a problem... I just prefer to keep the compiled file size and resources minimal; therefore, don't like to import packages unless absolutely necessary. On Monday, August 7, 2017 at 4:12:03 PM UTC-5, James Bardin wrote: > > They will

[go-nuts] Re: runtime.GOOS case

2017-08-07 Thread Dave Cheney
the GOOS values are case sensitive and currently all specified to be lower case; GOOS=linux != GOOS=Linux. You don't need to ToLower a runtime.GOOS as a. that would mean your Go installation was built with the wrong value b. by working around this it would hide the problem until it was harder to

[go-nuts] Re: runtime.GOOS case

2017-08-07 Thread James Bardin
They will always be lowercase, as the values are all defined in the code const GOOS = `android` const GOOS = `darwin` const GOOS = `dragonfly` const GOOS = `freebsd` const GOOS = `linux` const GOOS = `nacl` const GOOS = `netbsd` const GOOS = `openbsd` const GOOS = `plan9` const GOOS = `solaris`

Re: [go-nuts] runtime.GOOS case

2017-08-07 Thread Chris Manghane
You can see how the different runtime.GOOS values are defined in the OS-specific runtime files like https://github.com/golang/go/blob/master/src/runtime/internal/sys/zgoos_windows.go. They happen to be lowercase, but I don't know anything that guarantees that in any future. Curious though, why

[go-nuts] runtime.GOOS case

2017-08-07 Thread Eric Brown
This may be a completely stupid or trivial question; however... I currently use this on some old code I'm working on and trying to clean things up: switch os := strings.ToLower(runtime.GOOS); os { case "windows": // do windows stuff here case "linux": // do linux stuff here default:

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread roger peppe
On 7 Aug 2017 20:35, "Gert" wrote: On Monday, August 7, 2017 at 5:59:15 PM UTC+2, rog wrote: > > What is this supposed to do? What does it do if the value > isn't an integer? Same error as you do int("4") Um, have you tried that? It's a compiler error. > Are you

Re: [go-nuts] [Go2] append

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 9:52 PM Gert wrote: > Exactly, pretty sure some day if Go get used in a power plant or something we will have a outage for bugs like this that fly under the radar so easily passing all tooling, error checks and probably unit tests too :) Detecting

Re: [go-nuts] [Go2] append

2017-08-07 Thread Gert
On Monday, August 7, 2017 at 9:39:06 PM UTC+2, Jan Mercl wrote: > > > Does this code really output what you want it to output? > https://play.golang.org/p/DWQXtkGByv > > Assigning the result value of append to a different variable than its > first argument is completely valid, but one has to be

Re: [go-nuts] [Go2] append

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 9:23 PM Gert wrote: > Can append or the compiler be made to prevent or warn for bugs like this? No. Slice is a value and append accepts s not as its first argument. That means the new slice value need be returned for code that uses the resulting

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread Gert
On Monday, August 7, 2017 at 5:59:15 PM UTC+2, rog wrote: > > What is this supposed to do? What does it do if the value > isn't an integer? Same error as you do int("4") > Are you thinking that it would be the same as fmt.Println("value:", > r.Interface().(int)) ? > Nope more that it

[go-nuts] [Go2] append

2017-08-07 Thread Gert
Can append or the compiler be made to prevent or warn for bugs like this? package main import ( "fmt" ) func main() { a := []byte("Help") b := append(a, []byte(" Me ")...) c := append(a, []byte(" Her")...) fmt.Println(string(a), "-", string(b), "-", string(c)) } -- You received this message

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Uli Kunitz
I assume here that the proposal is not to change io.Reader but to create a new interface, maybe context.Reader. There are lot of uses of io.Reader where the Read operations will not block and therefore no context is necessary. A context.Reader would also require a wrapper function that

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread Jan Mercl
On Mon, Aug 7, 2017 at 4:23 PM wrote: > 2) find(sliceB, item_i_look_for) int, -1 for not found See https://golang.org/pkg/sort/#Search and friends -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-07 Thread Daniel Theophanes
Hello Micha, I'm not seeing any experiences (project building/maintaining) you are reporting on. In the projects I've worked on the switch to Context has been a huge win all across the board. I think it would be sweet to find an effect way to make io.Reader take a context (I often want just

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread roger peppe
On 7 August 2017 at 16:22, Gert Cuykens wrote: > On Mon, Aug 7, 2017 at 12:03 PM, roger peppe wrote: >> ISTM that the only thing you're suggesting is to change >> the spelling of "reflect.ValueOf" to "reflect". >> >> I don't understand what semantics

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread martin . rode
> > > Because it's easy to write a short correct find loop for the type you > are using, but a good implementation of append is a much larger > function. See also http://www.airs.com/blog/archives/559 . > So "append" is already done. May I propose to implement a generic "find" function?

Re: [go-nuts] [Blog] Context should go away for Go 2

2017-08-07 Thread Linker
Do you know Goroutine local storage ? On Mon, Aug 7, 2017 at 11:20 PM, wrote: > I also dont want to see context everywhere. At the same time, I don't want > it to be obfuscated in a confusing way. > > ctx is an unfortunate initialism and

Re: [go-nuts] Repository of self-contained functions

2017-08-07 Thread Michael Jones
i have the same. Like HAKMEM, just not as smart. On Mon, Aug 7, 2017 at 8:22 AM, Shawn Milochik wrote: > I like *idea* of that idea, but I suspect that the implementation > wouldn't work out. > > As the Go Proverb says: "A little copying is better than a little >

Re: [go-nuts] Repository of self-contained functions

2017-08-07 Thread Shawn Milochik
I like *idea* of that idea, but I suspect that the implementation wouldn't work out. As the Go Proverb says: "A little copying is better than a little dependency." I have a similar repo for my personal use, but I copy/paste from it rather than import it. It's a modern version of the folder we

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread Gert Cuykens
On Mon, Aug 7, 2017 at 12:03 PM, roger peppe wrote: > ISTM that the only thing you're suggesting is to change > the spelling of "reflect.ValueOf" to "reflect". > > I don't understand what semantics you'd expect > > fmt.Println("value:", r.Value(int)) > > to have.

[go-nuts] Re: How to automatically get all dependencies (even for tests)?

2017-08-07 Thread bhperry94
An easy way around this is to just import the package with an underscore before it in your main file. I only had one test package I needed so this worked well for me. i.e _"github.com/some/thing" On Monday, August 6, 2012 at 12:15:30 AM UTC-5, Steven Degutis wrote: > > `go get` and `go get .`

[go-nuts] [Blog] Context should go away for Go 2

2017-08-07 Thread as . utf8
I also dont want to see context everywhere. At the same time, I don't want it to be obfuscated in a confusing way. ctx is an unfortunate initialism and context.Context package stuttering doesn't help. I suppose you could stuff a pointer on the stack pointing to a potential context and then

[go-nuts] Repository of self-contained functions

2017-08-07 Thread Lukas Senger
Hi everybody, I've had this idea rolling around in my head for a while now and I'm not sure if it is worth diving into. What do you think of importing single functions from an online repository of functions that anybody can contribute to. Functions would be uniquely identified by their hash

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread Ian Lance Taylor
On Mon, Aug 7, 2017 at 7:44 AM, wrote: >> >> > 2) find(sliceB, item_i_look_for) int, -1 for not found >> > >> > Why can I not find easily search for an item inside a Slice. Every other >> > language I know has this. And I need this in a generic form. >> >> As you

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread martin . rode
> > > > Why can I not append something to a Slice in place, why does it have to > > return a new Slice? > > https://blog.golang.org/slices > > Ok, I will check that, thx. > > > 2) find(sliceB, item_i_look_for) int, -1 for not found > > > > Why can I not find easily search for an item

Re: [go-nuts] Broken Link in Go Assembly Guide

2017-08-07 Thread John McKown
On Sun, Aug 6, 2017 at 11:59 PM, Ben Reed wrote: > Hi... I was looking at the Go Assembly Guide ( http://itty.be/5rhhz ), > and I keep trying to refer to Plan 9 Assembly. I'm unfamiliar with this, > and so I keep trying to go to 9p.io. The link is broken though. Does >

Re: [go-nuts] "find" for Slices like "append"

2017-08-07 Thread Ian Lance Taylor
On Mon, Aug 7, 2017 at 6:45 AM, wrote: > Being fairly new to Go, I am trying to evaluate if it s possible and worth > to move our huge C++ codebase over to Go. > > 1) append(sliceA, my_new_item) sliceA > > Why can I not append something to a Slice in place, why

[go-nuts] Broken Link in Go Assembly Guide

2017-08-07 Thread Ben Reed
Hi... I was looking at the Go Assembly Guide ( http://itty.be/5rhhz ), and I keep trying to refer to Plan 9 Assembly. I'm unfamiliar with this, and so I keep trying to go to 9p.io. The link is broken though. Does anyone know where I can get an overview of this assembler? -- You received

[go-nuts] "find" for Slices like "append"

2017-08-07 Thread martin . rode
Being fairly new to Go, I am trying to evaluate if it s possible and worth to move our huge C++ codebase over to Go. 1) append(sliceA, my_new_item) sliceA Why can I not append something to a Slice in place, why does it have to return a new Slice? 2) find(sliceB, item_i_look_for) int, -1 for

[go-nuts] Re: why do we need generic thread.

2017-08-07 Thread adam.azarchs via golang-nuts
Personally I don't think a completely, um, generic version of generics is needed. But something like a list comprehension, possibly specifically limited to "select"/"map" type comprehensions which do not change slice or map length, would be invaluable. There's already a lot of special magic

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-07 Thread Konstantin Khomoutov
On Mon, Aug 07, 2017 at 06:25:48AM -0700, jianzhang...@gmail.com wrote: > Thank you very much for your patience and help. I got it and will try it > later. :) Glad to help! > > > golevelmatrix := [][]int{{1}, {3, 3}, {3, 3, 2}} > > >levelmatrix := make([][]C.int, len(golevelmatrix))

[go-nuts] [Blog] Context should go away for Go 2

2017-08-07 Thread faiface2202
Hi everyone! I've written a blog post called 'Context should go away for Go 2': https://faiface.github.io/post/context-should-go-away-go2/ The post is about the cancelation problem in Go, how context package solves it, why context package is bad anyway, and that Go 2 should do something about

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-07 Thread jianzhangbjz
Thank you very much for your patience and help. I got it and will try it later. :) 在 2017年8月7日星期一 UTC+8下午3:52:43,Konstantin Khomoutov写道: > > On Sun, Aug 06, 2017 at 07:08:03PM -0700, jianzh...@gmail.com > wrote: > > > Thanks your reply, I also used this way, but it still not work. code as >

Re: [go-nuts] Re: [Go2] Reflect

2017-08-07 Thread roger peppe
On 6 August 2017 at 21:51, Gert wrote: > Yes but its the way it's done that i think could be made more > straightforward, why not merge ValueOf and TypeOf in a build in intermediate > reflect type as in for example int(4) but then reflect(4) ISTM that the only thing

Re: [go-nuts] Realizing SSD random read IOPS

2017-08-07 Thread Manish Rai Jain
Hey folks, Just wanted to update the status of this. During Gophercon, I happened to meet Russ Cox and asked him the same question. If File::Read blocks goroutines, which then spawn new OS threads, in a long running job, there should be plenty of OS threads created already, so the random read

Re: [go-nuts] [CGO] how to pass a 2d slice to C?

2017-08-07 Thread Konstantin Khomoutov
On Sun, Aug 06, 2017 at 07:08:03PM -0700, jianzhang...@gmail.com wrote: > Thanks your reply, I also used this way, but it still not work. code as the > following. > > gonameunits := []string{"gpu0", "gpu1", "gpu2", "gpu3"} >nameunits := make([]*C.char, len(gonameunits)) >for i, _ :=

[go-nuts] Re: Goroutines chan to get data at specific time

2017-08-07 Thread desaiabhijit
looks better solution to restrict goroutines to continue it's pending work Thanks for the reply On Monday, August 7, 2017 at 8:21:09 AM UTC+5:30, Timothy Raymond wrote: > > I'm not entirely sure, but my intuition says that using `time.After` like > that with pending sends from another

RE: [go-nuts] Re: Goroutines chan to get data at specific time

2017-08-07 Thread John Souvestre
I’m not sure exactly what you are trying to accomplish, but I suspect that this article would help you. https://blog.golang.org/go-concurrency-patterns-timing-out-and John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On

Re: [go-nuts] Goroutines chan to get data at specific time

2017-08-07 Thread Konstantin Khomoutov
On Sun, Aug 06, 2017 at 12:53:08AM -0700, desaiabhi...@gmail.com wrote: > Can you please help with below code to get output at specific cutoff time > and exit [...] > c1 := make(chan string) > > go func() { //Sending data after certain time > > c1 <- "result 1" > >

Re: [go-nuts] all goroutines are asleep - deadlock!

2017-08-07 Thread Konstantin Khomoutov
On Fri, Aug 04, 2017 at 08:11:45AM -0700, prankpla...@gmail.com wrote: [...] > func fact_worker(fact_resp_chan chan string, x int) { > defer wg.Done() > response := factorial(x) > fact_resp_chan <- fmt.Sprintf("Factorial of %d is : %d", x, response) > } [...] Please also consider naming your