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

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.

[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

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

[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 // *

[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:

[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 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

[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

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

[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

[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

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,

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

[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

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

[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()

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()

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

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

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

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

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,

[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

[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

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

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.

[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

[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

[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

[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... > >

[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

[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

[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] 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 >

[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. >

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

2016-09-23 Thread Jan Mercl
Nothing prevents you from including the call stack in the error message. Especially if you prefer the way how Java error messages look. I don't. On Fri, Sep 23, 2016, 08:24 Yulrizka wrote: > Hello > > I was watching Dave Cheney's presentation in gopher conf and was >