[go-nuts] [ANN] styx - create 9P2000 file servers

2016-09-23 Thread David Arroyo
https://aqwari.net/net/styx It has taken quite a few more weekends than I expected, but I've produced the styx package and its subpackages as a way to write 9P file servers, with https://github.com/droyo/jsonfs serving as a demo. I have tried to take some inspiration from the standard library's ne

Re: [go-nuts] os.Getwd() returns path separated with "\" in windows troubles me

2016-09-23 Thread Ally Dale
I think I know what the mistake is, thanks a lot. 在 2016年9月24日星期六 UTC+8上午1:33:58,Ian Lance Taylor写道: > > On Fri, Sep 23, 2016 at 8:54 AM, Ally Dale > wrote: > > Golang std library such as path.Split() all suppose path is separated > with > > "/". > > Note that the path package is for slash s

Re: [go-nuts] Can concurrent part of GC still block/stall certain parts of program execution?

2016-09-23 Thread 'Zviad Metreveli' via golang-nuts
Thanks Caleb. I just tried building the binary using GO toolchain at 'master'. Unfortunately looks like the issue still persists. I will try to get a smaller repro of this that I can share with full code, meanwhile if there any other potential ideas as to how concurrent phase can stall whole G

Re: [go-nuts] How to generate a positive int64 from byte slice

2016-09-23 Thread Caleb Spare
You'll probably want to use encoding/binary. But which 8 of the 32 bytes are you going to use? (or really, which 63 bits?) -Caleb On Fri, Sep 23, 2016 at 5:25 PM, JohnGB wrote: > I have a byte slice 32 bytes long, and I would like to use it to generate a > positive int64. Is there a standard w

[go-nuts] How to generate a positive int64 from byte slice

2016-09-23 Thread JohnGB
I have a byte slice 32 bytes long, and I would like to use it to generate a positive int64. Is there a standard way to do this, or do I need to write my own function (most likely using bit shifts)? The backstory is that I need to generate unique (low collision likelihood) integer IDs from emai

[go-nuts] Re: understanding go stack trace

2016-09-23 Thread Dave Cheney
On Saturday, 24 September 2016 04:05:35 UTC+10, Ganesh Sangle wrote: > > I have a go process which has several go-routines, and these go-routines > are suppose to run every few seconds. > If not, they print a message that they are not being scheduled as > requested and abort the program. > How

[go-nuts] Re: Adding a title in godoc

2016-09-23 Thread DM
It seems the list was creating the problem. If I add a line after the text Pre-requisites it works as expected. // Package hello-world provides a helloworld example // // Pre-requisites // // I need to add the this line // * Go 1.5+ // * Linux or MacOS // * https://onsi.github.io/ginkgo/ for e

Re: [go-nuts] Re: Adding YAML to the stdlib

2016-09-23 Thread Gustavo Niemeyer
On Fri, Sep 23, 2016 at 5:02 PM, Zachary Gershman wrote: > Gustavo - it is not jus that YAML is well known, it is also widely used > (as I even mentioned). It is a *standard *even though some may not want > to consider it as such. If I can read xml in the stdlib why not yaml? And > it is widely s

[go-nuts] Adding a title in godoc

2016-09-23 Thread DM
I am trying to add a title in my godoc. I have referred godoctricks . My godoc looks like below:- // Package hello-world provides a helloworld example // // Pre-requisites // // * Go 1.5+ // * Linux or MacOS // * https://onsi.gith

[go-nuts] github.com/golang/glog: need information about the year in the log message

2016-09-23 Thread Michele Orsi
Hello, I am working with kubernetes and related projects that uses this library: https://github.com/golang/glog/blob/master/glog.go At the moment I am stuck because I am collecting logs from such applications, but the information about the year is missing in the header: https://github.com/golang/

[go-nuts] Re: Adding YAML to the stdlib

2016-09-23 Thread Zachary Gershman
Gustavo - it is not jus that YAML is well known, it is also widely used (as I even mentioned). It is a *standard *even though some may not want to consider it as such. If I can read xml in the stdlib why not yaml? And it is widely supported now but are you committed to supporting it for as long

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Zachary Gershman
Here's what I would add - lets make these changes and get it stable BEFORE we pull it in. I should be a thing we are happy to see merged. This can all be address in the changeset that proposes the merge. I don't see this as a huge blocker you just have to address this on the front side before it

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Zachary Gershman
Yes and vibrant open source projects need other outside contributors - that's not the point that is being made. Bringing it into the stdlib guarantees a level of support independent of the community. That guarantee doesn't depend on anyone one community members or even multiple members but by

Re: [go-nuts] Mobile + camera

2016-09-23 Thread Elias Naur
I don't expect Go on Android to have a lower footprint. You still have the Java runtime to drag around regardless. fre. 23. sep. 2016 kl. 19.29 skrev Glen Newton : > Hi Elias, > > Thanks for the update, I will try some things out. > > My use case is pretty simple: a go based web server on a very l

[go-nuts] Re: idea behind error interface and github.com/pkg/errors

2016-09-23 Thread Tamás Gulácsi
2016. szeptember 23., péntek 8:23:58 UTC+2 időpontban Yulrizka a következőt írta: > > Hello > > I was watching Dave Cheney's presentation in gopher conf and was > fascinated. > > (btw he also wrote a blog post here > http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully

[go-nuts] Re: Request for advice: Developing for Android

2016-09-23 Thread paraiso . marc
>But I'm still thinking of NativeScript as a viable alternative. Again NativeScript is alpha grade software and you're not going to learn Android development with that but NativeScript development. Which means less support, less resources available online ... There is nearly a decade of mat

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread 'Paul Borman' via golang-nuts
I would like to point out that Go itself is maintained by The Community. Sure Google has employees dedicated to Go (we use it internally, of course), but Go has been, since the beginning, and open source project with serious contributions from within and without Google. On Fri, Sep 23, 2016 at 11:

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Ranjib Dey
I'll ditto what Jesper said. Go's stdlib is fairly stable and coherent. YAML library does not support encoder/decoder that you can use with arbitrary io.Reader/Writers to marshall/unmarshall stuff. YAML as a spec if very messy. It allows embedding variables which has been exploited to hack backend

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Andy Balholm
What do you mean by “community”? Is it those of us who aren’t employed by Google? Is it any more unfair for the Go team at Google to expect Gustavo (or others) to maintain his YAML package than for some in the community to expect the Go team to take it over? Andy -- You received this message

[go-nuts] Re: Adding YAML to the stdlib

2016-09-23 Thread Gustavo Niemeyer
Hi Zachary, You have already seen the thread, but for the benefit of others, Zach's email comes from a thread raised and replied to yesterday on Twitter: https://twitter.com/jvehent/status/778687333956587522 As I said there, the yaml spec is big, messy, and I wouldn't encourage having the packag

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Jesper Louis Andersen
On Fri, Sep 23, 2016 at 8:06 PM, Zachary Gershman wrote: > I don't think the "I don't want this format in because I don't want to see > more of this format" doesn't work. People are going to keep using it, YAML > isn't a format that is going anywhere and I would love to know what you > would sugg

[go-nuts] understanding go stack trace

2016-09-23 Thread Ganesh Sangle
I have a go process which has several go-routines, and these go-routines are suppose to run every few seconds. If not, they print a message that they are not being scheduled as requested and abort the program. For example, on go routine prints something, sleeps for two seconds, and repeats this

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Zachary Gershman
I don't think the "I don't want this format in because I don't want to see more of this format" doesn't work. People are going to keep using it, YAML isn't a format that is going anywhere and I would love to know what you would suggest most people switch to as an alternative (don't say TOML or

Re: [go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Caleb Spare
I sincerely hope we never add YAML to the stdlib, as that would increase the amount of YAML in the world. > Also, it is slightly unfair to have the expectation that the community should > support a significant format through independent OSS work. Can you explain this? I don't follow. -Caleb On

[go-nuts] Adding YAML to the stdlib

2016-09-23 Thread Zachary Gershman
Hey All, I wanted to get feedback here first before I move this over to the golang-dev mailing list (or maybe we even just start a change-set). YAML as a spec is not the greatest and some would even describe it as "gross" but most if not all config files are written in some form of YAML (see

Re: [go-nuts] os.Getwd() returns path separated with "\" in windows troubles me

2016-09-23 Thread Ian Lance Taylor
On Fri, Sep 23, 2016 at 8:54 AM, Ally Dale wrote: > Golang std library such as path.Split() all suppose path is separated with > "/". Note that the path package is for slash separated strings, like URLs. If you are dealing with files, you should be using the path/filepath package. Ian -- You

Re: [go-nuts] Can concurrent part of GC still block/stall certain parts of program execution?

2016-09-23 Thread Caleb Spare
You could be experiencing https://github.com/golang/go/issues/16293. You can test this hypothesis by patching in the fix (https://github.com/golang/go/commit/cf4f1d07a189125a8774a923a3259126599e942b) yourself. That change will be released with Go 1.8. -Caleb On Fri, Sep 23, 2016 at 8:32 AM, zvia

Re: [go-nuts] Mobile + camera

2016-09-23 Thread Glen Newton
Hi Elias, Thanks for the update, I will try some things out. My use case is pretty simple: a go based web server on a very low end Android device where all it does is take a picture with the camera and serves it for each GET / on the web server. A Go based solution would have a lower footprint

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread ishantagarwal1986
Hi Every time you call time.After, it allocates a new time.Timer object. Morever someone in this link at last mentions that timer object does get cleaned up once the timer has fired. Also golang doc suggests that "The underlying

[go-nuts] Can concurrent part of GC still block/stall certain parts of program execution?

2016-09-23 Thread zviad via golang-nuts
Hello, As subject says, I was wondering if it is possible for concurrent part of GC process to still stall program execution. And if there are certain type of things that may still block. I am wondering about this, because we see this behavior in production both with Go 1.5 and 1.6. Here is e

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread ishantagarwal1986
Considering what is mentioned in the video, it looks like whenever a second has gone by and a message is not returned only then the exit from loop will happen. Which means the loop may run indefinitely as well if boring function keeps on returning something or the other within a second on the c

[go-nuts] os.Getwd() returns path separated with "\" in windows troubles me

2016-09-23 Thread Ally Dale
Golang std library such as path.Split() all suppose path is separated with "/". But os.Getwd() get a path separated with "\" such as "D:\temp" in windows. That does troubled gophers to deal with os.Getwd() return path by golang std library. So could go authers fix this case to let os.Getwd() ret

Re: [go-nuts] os.Getwd() returns path separated with "\" in windows troubles me

2016-09-23 Thread andrey mirtchovski
you shouldn't have to care whether it's "/" or "\". use os.PathSeparator to ensure that your code is correct on all systems. On Fri, Sep 23, 2016 at 9:54 AM, Ally Dale wrote: > Golang std library such as path.Split() all suppose path is separated with > "/". > But os.Getwd() get a path separated

Re: [go-nuts] Mobile + camera

2016-09-23 Thread Elias Naur
Hi Glen, The proposal for accessing Android APIs directly has landed: https://github.com/golang/go/issues/16876. In theory, that should be enough for accessing the camera from Go. In practice, the new features are very recent and you might encounter problems along the way. Feel free to report

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread Sam Whited
On Fri, Sep 23, 2016 at 9:13 AM, Sam Whited wrote: > The time.After channel isn't garbage collected until after the function > returns (when > it goes out of scope). I'm sorry, I just re-read my original email and it was very confusing; in the current code the timer is in fact GCed after each it

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread Sam Whited
On Fri, Sep 23, 2016 at 10:00 AM, wrote: > Considering what is mentioned in the video, it looks like whenever a second > has gone by and a message is not returned only then the exit from loop will > happen. > Which means the loop may run indefinitely as well if boring function keeps > on returni

Re: [go-nuts] Mobile + camera

2016-09-23 Thread Glen Newton
Are there any updates on this topic, i.e. can I use Go to talk to the Android camera? Thanks, Glen -- 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+u

Re: [go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Ian Davis
On Fri, Sep 23, 2016, at 03:35 PM, gary.willoug...@victoriaplumb.com wrote: > Yeah, the Json decoder should handle it. Maybe post a bug report? > https://github.com/golang/go/issues This has been raised before: https://github.com/golang/go/issues/12254 The answer is to use a reader to strip the

[go-nuts] Just because we can add multiple logical processors for the scheduler to use doesn’t mean we should

2016-09-23 Thread William Kennedy
There are many factors that will determine how well your program performs. There are no guarantees that using more threads or goroutines is going to yield better performance. Sometimes throwing more threads or goroutines at a problem can slow things down. It really depends on the work you are do

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread Debraj Manna
Thanks Sam for the reply. If I get you correctly then the entire loop will run for 1 second right because after 1second then time.After will return the current time on the channel and the function will return. On Sep 23, 2016 7:43 PM, "Sam Whited" wrote: On Fri, Sep 23, 2016 at 6:24 AM, DM wro

[go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread gary . willoughby
Yeah, the Json decoder should handle it. Maybe post a bug report? https://github.com/golang/go/issues On Friday, 23 September 2016 15:21:13 UTC+1, Mark Richman wrote: > > This works great, thanks! https://github.com/spkg/bom > > Agreed, JSON should not have BOM, however there is still software

[go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Mark Richman
This works great, thanks! https://github.com/spkg/bom Agreed, JSON should not have BOM, however there is still software out there, especially on Windows, which insist on writing out JSON with the BOM. So, I have to account for it, standard or not. On Friday, September 23, 2016 at 10:13:40 AM

Re: [go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread Sam Whited
On Fri, Sep 23, 2016 at 6:24 AM, DM wrote: > So a timer is started for 1 second. Before 1 second is over let's say boring > writes something to channel c then case s := <- c will be executed. The > moment somthing is written on channel c the timer that was started gets > garbage collected and t

[go-nuts] Re: Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread gary . willoughby
This looks like a compounded error. First, Json should never have a BOM encoded within it. Second, it seems like the Go Json decoder doesn't account for the BOM if it is mistakenly encoded. Both are mentioned in the Json RFC: https://tools.ietf.org/html/rfc7159#section-8.1 On Friday, 23 Septem

Re: [go-nuts] Go beginner asks for code review

2016-09-23 Thread Leandro Motta Barros
Just leaving my final tank you for everyone! You all really helped! Cheers, LMB On Thu, Sep 22, 2016 at 10:58 PM, Diego Medina wrote: > Hi, > > First, awesome that you started using Go! some thoughts inline: > > > >> 1. The sbxs_ prefix is there just because I expect this package to be >> part

Re: [go-nuts] Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Jesse McNelis
On Fri, Sep 23, 2016 at 9:37 PM, Mark Richman wrote: > > Is there any way to tell Decode() to ignore the BOM, or do I have to peek at > the first 3 bytes and skip them somehow? > What you need is an io.Reader that skips the BOM. Luckily someone wrote a package for that. https://github.com/spkg/bo

[go-nuts] An example web service implementation that runs on AWS Lambda and off-cloud

2016-09-23 Thread Howard Guo
Hey fellow Gophers. This is a small but rather complete exercise to demonstrate writing a Go web service that runs on AWS Lambda while retaining the capability of running it off-cloud as a stand-alone server: https://github.com/HouzuoGuo/optionalcloud Features: - Authenticate a user via usern

[go-nuts] How to upgrade a TLS Conn to transport http2

2016-09-23 Thread Rain Zen
I have a Conn accepted from tls.Listener: ln, err := tls.Listen("tcp", ":443", tlsConfig) conn, err := ln.Accpet() So now, can I convert the conn to support http2? I find a func in golang.org/x/net/http2: func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) It accepts a net.Conn and (ma

[go-nuts] Re: Trying to understand GOPATH

2016-09-23 Thread Diego Medina
As you start working with Go, one other thing you may want to add to your ~/.bash_profile (on linux and mac, not sure about others) is CDPATH=.:$GOPATH/src/code.google.com/p:$GOPATH/src/github.com:$GOPATH/src/bitbucket.org export CDPATH so let's say you have $GOPATH as /home/my-name/work/gol

[go-nuts] Re: Trying to understand GOPATH

2016-09-23 Thread leon . johnson
Thanks for the response, it makes sense now. On Friday, September 23, 2016 at 12:13:30 AM UTC-4, leon.j...@gmail.com wrote: > > I'm new to golang, and I'm trying to understand the role of GOPATH. The OS > X package from https://golang.org/dl/ installs to `/usr/local/go/bin/go`. > > Do I have to

[go-nuts] Re: I thought I understood floats...

2016-09-23 Thread thwd
Ah, brainfart. Delete this post. On Friday, September 23, 2016 at 1:32:09 PM UTC+2, thwd wrote: > > https://play.golang.org/p/mQhfM6QgQG > > According to this program, the float 3.0e-324 is greater than 0.0, but > 2.0e-324 is less than 0.0 > > I'm running into this problem in production... > > Wh

[go-nuts] Ignoring UTF-8 BOM when decoding JSON

2016-09-23 Thread Mark Richman
I have a JSON file which begins with the UTF-8 byte-order marker (BOM) 0xEF 0xBB 0xBF. This causes Decode() to fail with SyntaxError: SyntaxError invalid character 'ï' looking for beginning of value - Offset: 1 Is there any way to tell Decode() to ignore the BOM, or do I have to peek at the f

[go-nuts] I thought I understood floats...

2016-09-23 Thread thwd
https://play.golang.org/p/mQhfM6QgQG According to this program, the float 3.0e-324 is greater than 0.0, but 2.0e-324 is less than 0.0 I'm running into this problem in production... What causes this and what would be a strategy to remedy it? -- You received this message because you are subscri

[go-nuts] Timeout using Select from "Go Design Pattern"

2016-09-23 Thread DM
I was going through the *"Go Design Pattern"* talk by Rob Pike. Can some one explain me the doubt I am having in the slide Timeout using Select . In the the video this is the location where it is explained

[go-nuts] Just because we can add multiple logical processors for the scheduler to use doesn’t mean we should

2016-09-23 Thread WALID BELRHALMIA
Hello my golang brother, i was reading William kennedy post about Concurency https://www.goinggo.net/2014/01/concurrency-goroutines-and-gomaxprocs.html and at the end he said "Just because we can add multiple logical processors for the scheduler to use doesn’t mean we should" , because i

[go-nuts] Re: How to pass arbitrary typed (int, string, etc) slices to a golang function?

2016-09-23 Thread Fei Ding
在 2016年9月23日星期五 UTC+8下午12:13:04,Lax Clarke写道: > > How would someone create a function like len ? > > func Len(s []interface{}) would not work because compiler complains of > type mismatch if you call it with an integer slice (for example) > > Thanks > []interface{} is a concrete type, which is

Re: [go-nuts] Containers package

2016-09-23 Thread Jan Mercl
On Fri, Sep 23, 2016 at 11:36 AM wrote: > Currently, the https://golang.org/pkg/container/ package only heap, list, circular list implementations. Is there a plan to add the other useful data structure implementations in the near future? I don't think so. > If not then please suggest which thir

Re: [go-nuts] idea behind error interface and github.com/pkg/errors

2016-09-23 Thread Jan Mercl
On Fri, Sep 23, 2016 at 9:03 AM Ahmy Yulrizka wrote: > I understand that, I dont either. But what's the idea behind not having it at the first place? Is there more to it other than make it more simple? Being it an interface, it's universal. One can choose a simple number, string, etc. to be an e

[go-nuts] Containers package

2016-09-23 Thread subahjit
Currently, the https://golang.org/pkg/container/ package only heap, list, circular list implementations. Is there a plan to add the other useful data structure implementations in the near future? If not then please suggest which third party libraries are preferred? -- You received this message

[go-nuts] Re: Request for advice: Developing for Android

2016-09-23 Thread Peter Kleiweg
Op donderdag 22 september 2016 19:53:17 UTC+2 schreef Elias Naur: Does subsequent go gets after rm -fr'ing once, or only if you rm -fr before > go get every time? If it works from now on, you might have had some old > crud in the existing directory. If you need rm -fr every time, here's the > o

[go-nuts] Re: Request for advice: Developing for Android

2016-09-23 Thread Peter Kleiweg
Op vrijdag 23 september 2016 04:12:47 UTC+2 schreef parais...@gmail.com: > > My advice, unless you need to do some low level stuff with the NDK in C or > C++ use Java, that's the only viable way to develop for Android. > > With Phonegap (html,javascript) you will never take advantage of Android >

Re: [go-nuts] idea behind error interface and github.com/pkg/errors

2016-09-23 Thread Ahmy Yulrizka
I understand that, I dont either. But what's the idea behind not having it at the first place? Is there more to it other than make it more simple? On Fri, Sep 23, 2016, 8:29 AM Jan Mercl <0xj...@gmail.com> wrote: > Nothing prevents you from including the call stack in the error message. > Especia