[go-nuts] Appengine and main package

2017-10-31 Thread Sankar
Hi I am evaluating appengine for a golang project. It is a simple REST server with a bunch of endpoints. I am currently deploying it in AWS, in an EC2 instance. I have written a systemd script file which will take care of launching the webserver as a systemd service (so that it is always up etc

Re: [go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Lucio
Ian is perfectly right. Subtracting 31 days and then manually "normalising" to end-of-month would seem to give the result being sought here. The existing normalising rule makes perfect mathematical sense and slipping it this way or that on some spurious pretext will just confuse matters. Such a

[go-nuts] Re: Is the Go build for 1.9.2 (or maybe 1.4) meant to create $HOME/pprof/?

2017-10-31 Thread mikioh . mikioh
The details: https://go-review.googlesource.com/c/go/+/37652 and https://github.com/google/pprof/issues/107 -- 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 golan

[go-nuts] Re: Is the Go build for 1.9.2 (or maybe 1.4) meant to create $HOME/pprof/?

2017-10-31 Thread Lucio
On Wednesday, 1 November 2017 06:16:29 UTC+2, Lucio wrote: > > That's what I found (I was building as root, if that makes a difference), > but I was rather surprised to find a "pprof" when the only Go activity I > still recall from yesterday was a fresh Go build, first go1.4, then go1.9.2. > >

[go-nuts] Is the Go build for 1.9.2 (or maybe 1.4) meant to create $HOME/pprof/?

2017-10-31 Thread Lucio
That's what I found (I was building as root, if that makes a difference), but I was rather surprised to find a "pprof" when the only Go activity I still recall from yesterday was a fresh Go build, first go1.4, then go1.9.2. Lucio. -- You received this message because you are subscribed to the

Re: [go-nuts] Boolean query string conversion into functional logic

2017-10-31 Thread Hamish Ogilvy
Hey Jose, Yep, might be worth a look at: https://github.com/influxdata/influxql for a pretty advanced and open source version. Also look at Rob Pike's calculator talk: https://www.youtube.com/watch?v=PXoG0WX0r_E That helped me a lot. You basically need a tokeniser and you then scan the input in

RE: [go-nuts] time.AddDate() odd behavior

2017-10-31 Thread John Souvestre
> What rule tells us that one month before December 31 is November 30? Or, what rule tells us to normalize November 31 to November 30 rather than December 1? End-of-month mode is needed pretty often, in my experience. Perhaps there should be two rules so the user could choose which fits hi

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread Jesse McNelis
On Wed, Nov 1, 2017 at 3:42 AM, wrote: > Today you can't, Ayan. > It's very consistent, you can't compare an interface value reliably to any untyped constant. Because there is no way for the compiler to figure out what type it should take. https://play.golang.org/p/4Fn0YNE2md -- You received

[go-nuts] Re: tls field in struct m

2017-10-31 Thread melodyhuibo
Thanks a lot!. For amd64, it seems not call set_thread_area system call. so in amd 64, for tls, only useful information should be the tls[0] which points to current g, right? Thanks Melody On Tuesday, October 31, 2017 at 12:01:40 PM UTC-7, melod...@gmail.com wrote: > > Hi All, > > I have one q

Re: [go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Alex Dvoretskiy
Yes, there is no particular rule for this case. I guess it depends on the industry, department, or even particular individual. In finance, it would be normalized to November 30. In power engineering December 1. I'm not proposing. Just want to know other peoples opinions on this case for better

Re: [go-nuts] tls field in struct m

2017-10-31 Thread Ian Lance Taylor
On Tue, Oct 31, 2017 at 11:43 AM, wrote: > > I have one question about tls field in the m struct. > > I see fs:0FFF8h is storing the pointer to current g which is the > first element in tls field. > > In the m struct. tls is an six elements pointer array. I see the last five > has 0 v

Re: [go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Ian Lance Taylor
On Tue, Oct 31, 2017 at 10:53 AM, Alex Dvoretskiy wrote: > > package main > > import ( > "fmt" > "time" > ) > > func main() { > t := time.Date(2009, time.December, 31, 23, 0, 0, 0, time.UTC) > fmt.Println(t) > fmt.Println(t.AddDate(0, -1, 0)) > } > > https://play.golang.org/p/hZ7nhnkepK > > The re

[go-nuts] tls field in struct m

2017-10-31 Thread melodyhuibo
Hi All, I have one question about tls field in the m struct. I see fs:0FFF8h is storing the pointer to current g which is the first element in tls field. In the m struct. tls is an six elements pointer array. I see the last five has 0 value in it. I wonder what are these 5 element

Re: [go-nuts] Go vendoring question

2017-10-31 Thread Shawn Milochik
I'd just "vendor" it manually. Copy it into your vendor folder, and change its internal imports (if necessary) to remove the external (github) references, and update your own code to refer to "package" instead of "github.com/user/package." -- You received this message because you are subscribed

[go-nuts] Go vendoring question

2017-10-31 Thread Travis Keep
Somebody I depend on for my project made a breaking change to their git repo and broke my build. I found that if I simply revert their latest commit locally that my project builds. I don't necessarily want to vendor everything because most of the libraries I use I trust. But I do want to ven

[go-nuts] time.AddDate() odd behavior

2017-10-31 Thread Alex Dvoretskiy
Hello Golang-nuts, *package main* *import (* * "fmt"* * "time"* *)* *func main() {* * t := time.Date(2009, time.December, 31, 23, 0, 0, 0, time.UTC)* * fmt.Println(t)* * fmt.Println(t.AddDate(0, -1, 0))* *}* https://play.golang.org/p/hZ7nhnkepK The result is 2009-12-31 23:00:00 + UTC 2009

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread 'Axel Wagner' via golang-nuts
On Tue, Oct 31, 2017 at 5:33 PM, wrote: > The internal layout Go uses to store an interface should not mess with the > expected behavior. > If interface is two separate fields, or just a pointer, or refers to a > bitmap stored on the Moon, I don't care. I shouldn't care. And you don't have to c

Re: [go-nuts] Boolean query string conversion into functional logic

2017-10-31 Thread Jose
Hi Hamish, Any updates on how to tackle this problem with current Go tools ? Is it useful to use some of the Go parse tools or AST ? Thanks On Sat, Feb 22, 2014 at 11:01 AM, Hamish Ogilvy wrote: > Cool javascript, nice way to visualise! RPN was a useful tip, found one > interesting one Go base

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread Marvin Renich
* oju...@gmail.com [171031 12:34]: > Ian, with all due respect, I beg to differ. > > Let's look at that example posted 5 years back: > > http://play.golang.org/p/Isoo0CcAvr > > Yes, that is the proper behavior according to the rules, we have a FAQ > entry, fine, but ... put simply: that makes

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread Bruno Albuquerque
I am not sure what exactly is the issue you are complaining about. You can think of interface as a container for some data type. The container can be nil and the data contained in it can be nil. This looks reasonable to me as much as having a C++ vector that contains nil (well, nullptr) pointers.

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread ojucie
Today you can't, Ayan. On Tuesday, October 31, 2017 at 12:34:44 PM UTC-2, Ayan George wrote: > > > > On 10/31/2017 10:25 AM, oju...@gmail.com wrote: > > Not being able to test for a nil interface is a Go language bug. > > > > Just curious: How would you do this without type assertion or refle

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread ojucie
Ian, with all due respect, I beg to differ. Let's look at that example posted 5 years back: http://play.golang.org/p/Isoo0CcAvr Yes, that is the proper behavior according to the rules, we have a FAQ entry, fine, but ... put simply: that makes no sense. Why? Because we, the users, expect the co

[go-nuts] How to use HTTP proxy with net.Dial on TCP network?

2017-10-31 Thread Christian LeMoussel
I use net.DialTimeou to connects to endpoint address on "tcp" network conn, err := net.DialTimeout("tcp", endpoint, connectionTimeout) if err != nil { return nil, err } Is it possible to use HTTP proxy (http://111.222.333.444:3128) with net.Dial on TCP network? How can I d

Re: [go-nuts] go/types#Check is not resolving external package source positions.

2017-10-31 Thread adonovan via golang-nuts
Glad you got things working. A few quick remarks: 1) You don't need to call ParseDir or CreateFromFiles. The loader will figure out what files you need to load for each package; just call config.Import(packagename). 2) The go/types tutorial says that export data doesn't contain position inform

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread Ian Lance Taylor
On Tue, Oct 31, 2017 at 7:25 AM, wrote: > > Not being able to test for a nil interface is a Go language bug. > > Humans are fallible, so are our projects. Every project has its share of > errors. > Go, despite being a great tool we all love, is no exception to that > universal rule. Agreed about

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread Ayan George
On 10/31/2017 10:25 AM, oju...@gmail.com wrote: > Not being able to test for a nil interface is a Go language bug. > Just curious: How would you do this without type assertion or reflection? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2017-10-31 Thread ojucie
Not being able to test for a nil interface is a Go language bug. Humans are fallible, so are our projects. Every project has its share of errors. Go, despite being a great tool we all love, is no exception to that universal rule. -- You received this message because you are subscribed to the

[go-nuts] Is there a best way to use a global httpclient but with a different timeout setting per request?

2017-10-31 Thread mupenghaha
Is there a way to add a timeout setting for per request if i declare a global var? Because in my case i need different timeout setting for per request.Currently i am doing it with creating a new client object for per request: func getTiemoutClient(timeout int) *http.Client { client := &htt

[go-nuts] Re: Why cmd/compile/internal/syntax is not using go/ast ?

2017-10-31 Thread Dave Cheney
None that I know about, changing the go/ast parser would be very difficult given the Go 1 guarantee. On Tuesday, 31 October 2017 21:32:03 UTC+11, Abyx wrote: > > Are there plans on merging those two parsers? > > On Monday, October 30, 2017 at 10:12:18 PM UTC+3, Dave Cheney wrote: >> >> The short

[go-nuts] Re: Why cmd/compile/internal/syntax is not using go/ast ?

2017-10-31 Thread Abyx
Are there plans on merging those two parsers? On Monday, October 30, 2017 at 10:12:18 PM UTC+3, Dave Cheney wrote: > > The short version is the former was written before the Go compiler was > ported to Go. > > The longer story is laid out in this presentation from 2014. > https://www.youtube.com