[go-nuts] Static race detector?

2016-09-12 Thread josvazg
Why does Go does not have a static race detector? What are the difficulties? (just pointing me to the right docs to read is fine) I was thinking in a naive high level way... If Rust can do it, using its ownership model, Go could have a tool checking the AST that analyzes variable scopes and

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Egon
On Tuesday, 13 September 2016 06:31:20 UTC+3, davidmi...@gmail.com wrote: > > I've spent many, many, many hours on this (measured in days, at this > point) and I'm convinced that Golang is missing a fundamental programming > capability, that of multidimensional associative arrays. Searching

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Tamás Gulácsi
2016. szeptember 13., kedd 4:01:24 UTC+2 időpontban davidmi...@gmail.com a következőt írta: > > My response is inline. > > On Monday, September 12, 2016 at 4:13:10 PM UTC-4, Tamás Gulácsi wrote: >> >> TL;DR >> I know what concurrency is. >> > > ok, but I wasn't explaining concurrency to

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Tamás Gulácsi
2016. szeptember 13., kedd 3:50:45 UTC+2 időpontban davidmi...@gmail.com a következőt írta: > > My response is inline. > > On Monday, September 12, 2016 at 7:43:12 PM UTC-4, Keith Randall wrote: >> >> Tamás's suggestion of using [4]string as the key is a good one. You >> could use any

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Dan Kortschak
Another way that you can use (based on a recursive map[string]T - where T is an interface type - can be seen here where I use it create a filesystem of arbitrary behaviours). https://github.com/ev3go/sisyphus The general case though uses map[string]interface{}. Each time you want to add a layer

Re: [go-nuts] How Golang implements slice?

2016-09-12 Thread Edward Muller
On Mon, Sep 12, 2016 at 8:17 PM Fei Ding wrote: > Hi guys: > > I met a problem when I try to understand slice when using as function > parameters. After writing some code, I made a conclusion by myself, but > need some real check and explanation here, with your help. > > As

Re: [go-nuts] Cross-compilation of golang assembly via 'go tool asm'

2016-09-12 Thread Michael Hudson-Doyle
On 13 September 2016 at 13:43, wrote: > I'm implementing cross-compilation support in rules_go > . This takes a low-level > approach to building golang targets that involves use of the individual > toolchain components such as 'go tool

[go-nuts] Re: Oops ! i thought 'go' would be an easy to use programming language like BASIC or Scratch ( ! )

2016-09-12 Thread Dave Cheney
I'm sorry you've not enjoyed Go. How to uninstall Go will depend on how you installed it. I'll give tree options, if they do not apply, please reply with more detail about how you installed Go. 1. If you installed Go via homebrew, which is quite common, use the brew command to uninstall Go 2.

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Dan Kortschak
On Mon, 2016-09-12 at 20:26 -0700, davidmiller...@gmail.com wrote: > Well, PHP is also free. It can do multidimensional associative arrays > and much more. What good is Golang's tremendous efficiency if it isn't > capable of doing what is needed in the first place? Depends on how much work you

Re: [go-nuts] parsing millisecond coming after colon

2016-09-12 Thread Caleb Spare
As Dave said, you should check the error, but unfortunately I think you'll find that time.Parse doesn't handle fractional seconds that use a character other than . as a decimal separator. One possible workaround would be to replace all the : with . first: https://play.golang.org/p/h_IMQxtoVI

Re: [go-nuts] Best way to extract hostname from "host" or "host:port" style?

2016-09-12 Thread Edward Muller
There is probably some code here ( https://github.com/golang/go/commit/1ff19201fd898c3e1a0ed5d3458c81c1f062570b) you can lift until go1.8 comes out. On Mon, Sep 12, 2016 at 8:17 PM Jonathan Yu wrote: > Hi, > > I tried searching Google, but didn't find anything. I'm

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread davidmiller124
I've spent many, many, many hours on this (measured in days, at this point) and I'm convinced that Golang is missing a fundamental programming capability, that of multidimensional associative arrays. Searching through this forum's archives and other sites, I've found that I'm not the first one

[go-nuts] parsing millisecond coming after colon

2016-09-12 Thread Dave Cheney
You're ignoring the error from time.Parse, that will tell you what went wrong. -- 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

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread davidmiller124
Thank you for clarifying. My response is inline. On Monday, September 12, 2016 at 11:20:10 PM UTC-4, kortschak wrote: > > On Mon, 2016-09-12 at 20:06 -0700, davidmi...@gmail.com > wrote: > > If I understand that correctly, my index key is now "Folder_1 > > Folder_2 > > Folder_3 Folder_4"

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Dan Kortschak
On Mon, 2016-09-12 at 20:06 -0700, davidmiller...@gmail.com wrote: > If I understand that correctly, my index key is now "Folder_1 > Folder_2 > Folder_3 Folder_4" and my value is now "File_Name_1". How would I now > assign "File_Name_2" to Folder_2, for example? The key would be

[go-nuts] Oops ! i thought 'go' would be an easy to use programming language like BASIC or Scratch ( ! )

2016-09-12 Thread Chrstphre Campbell
Now that it turns out to be some kind of crazy Assembler Code for Terminal, i would like to delete it, But the Brief and cursory instructions for how to do this; Assumes that i am already fluent in Unix or Whatever ? Could someone provide me with instructions for how to remove it; for a 6_year

[go-nuts] Linux SYS_SETGROUPS problem in forkAndExecInChild?

2016-09-12 Thread celledge
I think that golang on Linux ARM is inappropriately using the 16bit variant of the setgroups syscall when using exec. I've been having problems with setting additional groups on a Linux ARM system with a statement like this: groups = []uint32{20, 21} cmd.SysProcAttr.Credential = {Groups:

[go-nuts] Best way to extract hostname from "host" or "host:port" style?

2016-09-12 Thread Jonathan Yu
Hi, I tried searching Google, but didn't find anything. I'm probably just missing something obvious here, but I'm relatively new to Go - please bear with me :) In URLs (of the net/url variety), the Host field may be either a hostname or host/port combination. In the combined host/port case,

Re: [go-nuts] Re: add default implementation to interfaces ( similar to abstract class in java)

2016-09-12 Thread adrianwit via golang-nuts
Agreed, that said I'm still unclear while implementing interface, is it better to use anonymous or explicit interface embedding: That might help too: Abstract Classes in Go On Monday, 3 September 2012 14:25:59

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread davidmiller124
Thank you for clarifying that, but how does that resolve my problem? The output I get is. map[[Folder_1 Folder_2 Folder_3 Folder_4]:File_Name_1] If I understand that correctly, my index key is now "Folder_1 Folder_2 Folder_3 Folder_4" and my value is now "File_Name_1". How would I now

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Dan Kortschak
https://play.golang.org/p/6ZyybAKWpp On Mon, 2016-09-12 at 18:50 -0700, davidmiller...@gmail.com wrote: > I tried that. I can't seem to get it to work. I'm clearly doing > something > wrong, probably because I am misunderstanding Tamás's response. > > Test_Map := make(map[[4]string]string) >

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread davidmiller124
My response is inline. On Monday, September 12, 2016 at 4:13:10 PM UTC-4, Tamás Gulácsi wrote: > > TL;DR > I know what concurrency is. > ok, but I wasn't explaining concurrency to you. If you're referring to the paragraph about the cars, I was explaining why your answer was incorrect. I

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread davidmiller124
My response is inline. On Monday, September 12, 2016 at 7:43:12 PM UTC-4, Keith Randall wrote: > > Tamás's suggestion of using [4]string as the key is a good one. You could > use any struct you want as well, if you want to name the parts of the key. > I tried that. I can't seem to get it

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread Caleb Spare
If you have a data race, you lose a lot of guarantees about the correct operation of your program. It may work today but fail occasionally, or a future version of the compiler may break it very badly. See

Re: [go-nuts] Re: Assigning +Inf to a float32 ..

2016-09-12 Thread xiiophen
On Monday, 12 September 2016 23:39:09 UTC+1, Michael Jones wrote: > > Actually, you would also want a way to say “which type of NaN” as there > are two classes and several subclasses. I wrote code for this a while back > and posted it here (IIRC). > > > yes -I'm aware of 'signalling' and

Re: [go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Justin Israel
On Tue, Sep 13, 2016 at 7:42 AM wrote: > > *One of the primary benefits of concurrency is that if one procedure gets > stuck or slows down, other procedures can keep moving along, evading the > bottleneck. Once you throw a shared bottleneck into the concurrent >

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread 'Keith Randall' via golang-nuts
Tamás's suggestion of using [4]string as the key is a good one. You could use any struct you want as well, if you want to name the parts of the key. How are you using the map? If you're only reading the map, then concurrent access is allowed. Concurrent access is only forbidden if one of the

[go-nuts] Re: make a struct pointer _not_ implement an interface

2016-09-12 Thread Tyler Compton
I don't believe this is possible. See the spec on method sets[1]. The excerpt I'm looking at: > The method set of any other type T consists of all methods > declared with receiver > type T. The method set of the corresponding pointer type >

Re: [go-nuts] Re: Assigning +Inf to a float32 ..

2016-09-12 Thread Michael Jones
Actually, you would also want a way to say “which type of NaN” as there are two classes and several subclasses. I wrote code for this a while back and posted it here (IIRC). From: on behalf of Date: Sunday, September 11, 2016 at 6:32 AM To:

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread adonovan via golang-nuts
On Monday, 12 September 2016 12:04:30 UTC-4, sqweek E. wrote: > > Yes, through plain assignment. What problems arise from that? > Here's the general form of the problem. In the code below, one goroutine (f) creates a variable, initializes it (x=1), then shares its address with another

[go-nuts] make a struct pointer _not_ implement an interface

2016-09-12 Thread Alex Flint
Is it possible to have a struct that implements an interface, but have pointers to the struct not implement the interface? The reason is that I want to find all the places in our codebase that attempt to use a pointer to a certain struct as a certain interface. -- You received this message

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Tamás Gulácsi
TL;DR I know what concurrency is. For a map access, if you hold the lock for as few instructions as possible, it shouldn't hurt much. If you're after an idea of the best solution, that will be harser - maybe not a map is the best answer for your specific use case, but a slice. Or a slice of

[go-nuts] C Syscall Memory Code Review

2016-09-12 Thread Luke Mauldin
Can you please review the code here: https://play.golang.org/p/Yk6nqHhtTo This forms the basis of a "memory" package which I am using on Windows to do interoperability with some C APIs. These existing C APIs sometimes take/return a C-null terminated pointer and sometimes they take/return a

Re: [go-nuts] Re: [ANN] A Go based map reduce system (second attempt)

2016-09-12 Thread Henrik Johansson
Perhaps something like this? https://github.com/pachyderm/chess mån 12 sep. 2016 kl 18:32 skrev David Crawshaw : > The map-reduce systems I've worked with in the past bundle up the map > and reduce functions in a binary, distribute it, and then communicate > with it by an

Re: [go-nuts] Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread Caleb Spare
That's still a data race. Are you using the race detector? On Mon, Sep 12, 2016 at 9:04 AM, sqweek E. wrote: > Yes, through plain assignment. What problems arise from that? > > On Monday, September 12, 2016 at 11:21:05 PM UTC+8, Peter Bourgon wrote: >> >> How are you replacing

[go-nuts] Re: Multiple-reader single-writer map access - is this lockless workaround safe?

2016-09-12 Thread pierre . curto
You might be interested in this: https://golang.org/pkg/sync/atomic/#Value Le lundi 12 septembre 2016 17:04:39 UTC+2, sqweek E. a écrit : > > Ok so after getting away with using maps to share data between threads for > a lng time, I've finally seen the light and accepted that this is not >

[go-nuts] Why is there no " declared and not used" compile error?

2016-09-12 Thread Sjon Kosse
Hello, Const values can be accesed still by reflection in a reasonable manner. This question has come by quite a few times before on the mailing list, better explanations should be easy to find. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: Two Related Questions. (1) Map Concurrency (2) Making Multidimensional Arrays

2016-09-12 Thread Tamás Gulácsi
2016. szeptember 12., hétfő 7:28:26 UTC+2 időpontban davidmi...@gmail.com a következőt írta: > > *I have two Golang questions that I hope someone could help me out with.* > > > *1) Am I misunderstanding Golang maps?* > > > *I'm trying to translate a project from PHP to Golang for the websockets

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Nathan Fisher
s/hilarious/sad/ If I had a pound for every time I've had to create custom packages/repos for various languages, libraries and apps... I could buy myself a fancy dinner or two. Mon, 12 Sep 2016 at 08:21, Dave Cheney wrote: > Distros are always out of date, sometimes

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Micky
Go doesn't need anything. You just need to write more code ;) On Sun, Sep 11, 2016 at 6:43 PM, Mark Richman wrote: > I'm somewhat new to the community, and seek to understand its challenges > better. I'm also looking for opportunities to contribute. > > To that end, what

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Michael Hudson-Doyle
On 12 September 2016 at 21:53, Dave Cheney wrote: > Ubuntu 12.04 LTS ships with Go 1.0. > Ubuntu 14.04 LTS ships with Go 1.2 > Ubuntu 16.04 LTS ships with Go 1.6 (I hope) > Yeah, 1.6 got into 16.04. > None of the LTS versions of Ubuntu ship with a supporter version of Go. >

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Tim Hawkins
But fedora for example is stuck on 1.6 until fedora 25 is released, its a simular situation to elasticsearch, distro version is old, and has severe limitations, nobody in thier right mind would install from there. Far far safer to use the official version fom the elastic.co site. The same is

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Tim Hawkins
Especialy since the distros often lag the release cycle by quite a bit. 1.7.x is not due on Fedora until release 25, which is several months away. On 12 Sep 2016 09:58, "Dave Cheney" wrote: An 'official' deb/apt/yum repo for Go would be much appreciated,

Re: [go-nuts] A compatible extension to the for construct

2016-09-12 Thread Lucio De Re
On 9/12/16, Ian Lance Taylor wrote: > > My guess as to what this means is that it is precisely equivalent to > for x++; x < n; x++ { > I can't argue with your analysis, it seems flawless and I didn't spot that. I'm going to go back where I thought continue would be the only

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Henrik Johansson
Some distros suffer less from this. Arch is perfectly up2date in line with its rolling approach. I agree with Dave that a supported repo is very nice. It is not unusual for companies to lag behind even on LTS installs but still having a need for updates of a particular software. mån 12 sep.

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Dave Cheney
Ubuntu 12.04 LTS ships with Go 1.0. Ubuntu 14.04 LTS ships with Go 1.2 Ubuntu 16.04 LTS ships with Go 1.6 (I hope) None of the LTS versions of Ubuntu ship with a supporter version of Go. This is a policy decision by Ubuntu. What Go needs is an official repo, just like Chrome has. > On 12 Sep

Re: [go-nuts] What 5 things does Go need in 2017?

2016-09-12 Thread Russel Winder
On Sun, 2016-09-11 at 18:58 -0700, Dave Cheney wrote: > An 'official' deb/apt/yum repo for Go would be much  > appreciated, https://github.com/golang/go/issues/10965 > Go stuff is packaged for Debian and Fedora, they are the official Debian and Fedora packages. Any other packages in any other

[go-nuts] Re: Handling multiple things happening at the same time

2016-09-12 Thread Matt Davies
Thanks for everyones help. I'm going to go with the subroutine for now. This is all the app does, download a file, manipulate it, then serve it up for pick up. It does the download and manipulate action once a day, and the upload happens once a day. We've got raven emailing us if anything

[go-nuts] Re: [ANN] A Go based map reduce system (second attempt)

2016-09-12 Thread Raj
>> However, it is still limited by the fact that Go code can not be sent and executed remotely. I am not sure if this makes the situation better for this particular use case, but I see that David Crawshaw is working on plugin mode for Go. It looks like it will be part of Go1.8. -- You

[go-nuts] Re: [ANN] A terminal based search engine for bash commands, built with Go

2016-09-12 Thread Pieter Slabbert
You have the build artifacts in the git repository. It really bloats the download size to have to download every architectures artifact when I want to get the source. Also for each release this will bloat the repo even more. On Sunday, 11 September 2016 19:52:12 UTC+2, johnny-john wrote: > >

[go-nuts] [ANN] A Go based map reduce system (second attempt)

2016-09-12 Thread ChrisLu
Hi, This is a second attempt to build a Go based map reduce system. The first attempt, https://github.com/chrislusf/glow, can already be executed distributedly. However, it is still limited by the fact that Go code can not be sent and executed remotely. I just started to work on a Go+Lua