Re: [go-nuts] Presidence of Operators

2018-12-14 Thread fgergo
Could you please give 2 examples, where the results depend on the precedence? Maybe on play.golang.org ? Maybe this also helps: https://golang.org/ref/spec#Operators On 12/14/18, 伊藤和也 wrote: > Can I say the precedence of paretheses are lower than unary operators and > higher than binary

Re: [go-nuts] Presidence of Operators

2018-12-14 Thread Jan Mercl
On Fri, Dec 14, 2018 at 7:45 AM 伊藤和也 wrote: > Can I say the precedence of paretheses are lower than unary operators and higher than binary operators. As parenthesis are not operators they have no operator precedence. But see: https://golang.org/ref/spec#Order_of_evaluation Explicit

Re: [go-nuts] Presidence of Operators

2018-12-14 Thread fgergo
(please reply to the list, so others with a similar question can find this thread.) I'm sorry, I should have made it clear: for me it's hard to parse the question. I'll try again: could you please write 1 working example in play.golang.org with the assumed precedence rules? If you could share a

[go-nuts] Q on using reflect: how to distinguish methods from functions?

2018-12-14 Thread Kevin Malachowski
Why do you need to figure out whether something is a Method? Usually it doesn't really matter. (I don't have an answer for you, but if you give more background I or someone else may be able to be more useful; trying to avoid the X-Y problem.) -- You received this message because you are

[go-nuts] Re: mongodb driver for go

2018-12-14 Thread Jérôme LAFORGE
Hello, We also use this driver https://godoc.org/github.com/globalsign/mgo in production with pb. -- 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] Plan9 reborn as a guest OS atop of Golang runtime

2018-12-14 Thread Michael Jones
I think we should have an effort to gather learnings from these efforts and make Go2 proposals as appropriate. Perhaps best done simply by encouraging these developers to say what they need changed, added, or removed and why. On Fri, Dec 14, 2018 at 11:11 AM ct via golang-nuts <

Re: [go-nuts] go assembly question

2018-12-14 Thread robert engels
Thanks, I have already replied - would of saved you the typing trouble. As I pointed out, the lack of register prefixes (which would screen AT at me), was what really confused me. > On Dec 14, 2018, at 4:09 PM, Ian Denhardt wrote: > > If you pass `-M intel` to objdump it will display intel

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread Bakul Shah
On Dec 14, 2018, at 12:50 PM, Michael Jones wrote: > > Have been thinking about pure functions (in the Scheme sense of no > externalities other than constants and pure functions and no side effects) in > the context of weak metaprogramming and compiler optimization. Here is the > idea.

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread Ian Denhardt
Quoting Bakul Shah (2018-12-14 16:11:51) > > If a function was labeled as pure ("pure func ...") the compiler > > would not even need think hard, and if purity were a reflectable > > attribute, then it is imaginable that compiling a function > > invocation could be: > > This would complicate the

Re: [go-nuts] go assembly question

2018-12-14 Thread Ian Denhardt
If you pass `-M intel` to objdump it will display intel syntax. Quoting robert engels (2018-12-14 16:41:39) >but the operands are backwards according to MOVQ on Intel, it >should be >dst,src >SO, I'm thinking "intermediate code", so different syntax. Fine, but >then when I use

Re: [go-nuts] Re: json and interface unmarshalling

2018-12-14 Thread Sam Whited
Hi, In the future, please don't apply formatting when you're emailing code. Lots of people will have lots of different mail clients, and it's not always obvious how the colors will interact or whether they'll be readable against different backgrounds, or by people with various visual

[go-nuts] Q on using reflect: how to distinguish methods from functions?

2018-12-14 Thread Jason E. Aten
I need to figure out if a reflect.Value that is a function (Func) has a receiver (i.e. it is a method) or if the Func is just a plain function with no receiver in its signature. Here's what I came up (which does appear to solve the question in the limited cases I've tested)... but I'm

[go-nuts] Pure functions and Go2

2018-12-14 Thread Michael Jones
Have been thinking about pure functions (in the Scheme sense of no externalities other than constants and pure functions and no side effects) in the context of weak metaprogramming and compiler optimization. Here is the idea. : a := math.Sin(0.1234) : b := bits.RotateLeft64(0x12345678, 7) : func

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread Michael Jones
I don't actually prefer marking a func as pure. best if it is a discovered attribute during compilation. Not sure what you mean about complexity. The compiler would not be obligated. On Fri, Dec 14, 2018 at 1:12 PM Bakul Shah wrote: > On Dec 14, 2018, at 12:50 PM, Michael Jones > wrote: > >

[go-nuts] Re: Q on using reflect: how to distinguish methods from functions?

2018-12-14 Thread Jason E. Aten
On Friday, December 14, 2018 at 2:45:44 PM UTC-6, Jason E. Aten wrote: > > > > On Friday, December 14, 2018 at 2:19:05 PM UTC-6, Kevin Malachowski wrote: >> >> Why do you need to figure out whether something is a Method? Usually it >> doesn't really matter. >> >> (I don't have an answer for

Re: [go-nuts] go assembly question

2018-12-14 Thread robert engels
The tools all emit AT/amd syntax by default and you can use -M intel to get the intel format. The confusing thing is that they don’t use the ‘register prefixes’, so it looks like intel but it is backwards. Oh well. > On Dec 14, 2018, at 3:41 PM, robert engels wrote: > > In the go assembly

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread Bakul Shah
> On Dec 14, 2018, at 1:17 PM, Michael Jones wrote: > > I don't actually prefer marking a func as pure. best if it is a discovered > attribute during compilation. You said > If a function was labeled as pure ("pure func ...") the compiler would not > even need think hard I thought you

[go-nuts] Re: json and interface unmarshalling

2018-12-14 Thread Darko Luketic
Of course after I ask my question I find the answer on my own. It's always like this. The solution is to change type MessageRequest struct { Typestring `json:"type"` Payload json.RawMessage `json:"payload"` } So the payload isn't unmarshalled. Now, after the MessageRequest

Re: [go-nuts] Homoiconic metaprogramming in Go

2018-12-14 Thread howardcshaw
Not sure where you got this impression - commands run by go generate have only the OS environment. They are just ordinary commands, as might be run by any shell script, just the calls to them are integrated into the Go tooling. Tools that seem to access go syntax trees and the like? They are

Re: [go-nuts] Homoiconic metaprogramming in Go

2018-12-14 Thread roger peppe
On Fri, 14 Dec 2018 at 14:01, wrote: > Not sure where you got this impression - commands run by go generate have > only the OS environment. They are just ordinary commands, as might be run > by any shell script, just the calls to them are integrated into the Go > tooling. > > Tools that seem to

[go-nuts] Machine readable https://golang.org/dl/

2018-12-14 Thread bolson
I'm looking at the tables at https://golang.org/dl/ and hoping there's data behind that which could be made visible. I'm hoping to write a script for a build server such that nightly it could ensure it's running the latest version of go1.*.linux-amd64.tar.gz https://golang.org/dl/index.json or

[go-nuts] Re: mongodb driver for go

2018-12-14 Thread Brian van den Broek
On Friday, 14 December 2018 13:01:09 UTC-5, Badhmanaban M wrote: > > Hi, is there any native mongodb driver for golang > Mongodb is working on one. Beta1 was last week. https://github.com/mongodb/mongo-go-driver/releases Best, Brian vdB -- You received this message because you are

[go-nuts] Re: mongodb driver for go

2018-12-14 Thread Jérôme LAFORGE
Sorry, mistyping: We are using globalsign driver without problem in production. For your information, globalsign is fork of https://godoc.org/gopkg.in/mgo.v2 since mgo.v2 is unmaintained. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Go assembly interface calls

2018-12-14 Thread robert engels
Are there any examples of a hand-written assembly function that accepts an interface and then makes calls on the interface methods? In reviewing the documentation, it seems impossible, as the PCDATA, and FUNCDATA are not documented, and thus, I think the GC scanner ends up barfing when these

Re: [go-nuts] Pause failures, GC, & StopTheWorld

2018-12-14 Thread robert engels
Usually if it is hung doing an allocation, that means that the STW cannot complete, which means some go routine is in a tight loop no yielding to the scheduler. The only other possibility (I would think) is if you placed a cap on the memory size of the process, and it is trying to allocate but

[go-nuts] Re: mongodb driver for go

2018-12-14 Thread oldCoderException
We've been using this one in production for quite some time: https://godoc.org/gopkg.in/mgo.v2 Interesting to see the MongoDB folks doing one now too. :) Paul On Friday, 14 December 2018 10:01:09 UTC-8, Badhmanaban M wrote: > > Hi, is there any native mongodb driver for golang > -- You

Re: [go-nuts] How to add a new operator

2018-12-14 Thread Jason E. Aten
In order to see where the "expected operand" syntax error is coming from (it could be many places), add a panic at the top of the error handling parser methods in go/src/cmd/compile/internal/syntax/parser.go's error handling routines, which may be called variously parser.error(),

[go-nuts] Re: Zombie Child process not being claimed by wait

2018-12-14 Thread Jason E. Aten
Totally just a guess, but when I saw slow Process.Wait(), I was able to solve it by using syscall.wait4() directly per Ian's suggestion. Made a little library: https://github.com/glycerine/bark that will call pid, err := syscall.Wait4(w.proc.Pid, , syscall.WNOHANG, nil) On Thursday, December

[go-nuts] Go 1.11.4 and Go 1.10.7 are released

2018-12-14 Thread Filippo Valsorda
Hello gophers, We have just released Go versions 1.11.4 and 1.10.7, minor point releases. These releases include fixes to cgo, the compiler, linker, runtime, documentation, go command, and the net/http and go/types packages. They include a fix to a bug introduced in Go 1.11.3 and Go 1.10.6 that

Re: [go-nuts] Versioning golang.org/x/foo packages

2018-12-14 Thread David Riley
Oh man, I searched in vain for any kind of discussion exactly like that issue. Your Google-fu is clearly superior to mine. Thanks! :-) > On Dec 14, 2018, at 10:08 AM, Paul Jolly wrote: > > Just to briefly note the discussion in > https://github.com/golang/go/issues/27858 (and other issues

[go-nuts] Versioning golang.org/x/foo packages

2018-12-14 Thread David Riley
Hi all, We're building with go 1.10.x and dep for a project at work, and having been bitten twice in the space of a week with unversioned upstream executables fetched via "go get" causing strife with versioned vendor code fetched by "dep", we've been working on making our build environment

[go-nuts] Re: Unix binary installations for Go

2018-12-14 Thread Ronny Bangsund
Which Unix/derivative? The great thing about them is that they have so many standards to choose from ;) "go build" isn't sufficient for most of my projects, if I want proper distribution of binaries. I might use "go generate" to create some data/source a program depends on, and I always embed

Re: [go-nuts] Versioning golang.org/x/foo packages

2018-12-14 Thread Paul Jolly
Just to briefly note the discussion in https://github.com/golang/go/issues/27858 (and other issues linked within that one). On Fri, 14 Dec 2018 at 15:00, David Riley wrote: > > Hi all, > > We're building with go 1.10.x and dep for a project at work, and having been > bitten twice in the space of

Re: [go-nuts] Re: Unix binary installations for Go

2018-12-14 Thread 'Rudolf Polzer' via golang-nuts
On Fri, Dec 14, 2018 at 10:44 AM Ronny Bangsund wrote: > Which Unix/derivative? The great thing about them is that they have so > many standards to choose from ;) > Linux, and it should support the FHS :) > > "go build" isn't sufficient for most of my projects, if I want proper > distribution

Re: [go-nuts] Homoiconic metaprogramming in Go

2018-12-14 Thread Michael Jones
I've been thinking about a related idea for the past while ... "pure functions" ... i'll post an email about it now. On Fri, Dec 14, 2018 at 6:06 AM roger peppe wrote: > On Fri, 14 Dec 2018 at 14:01, wrote: > >> Not sure where you got this impression - commands run by go generate have >> only

[go-nuts] Re: Q on using reflect: how to distinguish methods from functions?

2018-12-14 Thread Jason E. Aten
On Friday, December 14, 2018 at 2:19:05 PM UTC-6, Kevin Malachowski wrote: > > Why do you need to figure out whether something is a Method? Usually it > doesn't really matter. > > (I don't have an answer for you, but if you give more background I or > someone else may be able to be more

[go-nuts] go assembly question

2018-12-14 Thread robert engels
In the go assembly docs, for example: 64-bit Intel 386 (a.k.a. amd64) The two architectures behave largely the same at the assembler level. Assembly code to access the m and gpointers on the 64-bit version is the same as on the 32-bit 386, except it uses MOVQ rather than MOVL: get_tls(CX)

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread Michael Jones
I can't deny proposing it, but i'd much rather it be inferred...if fo no other reason than because the developer could be wrong and that would be an insidious flaw to debug. I proposed it defensively so that the initial reactions might not all be that it is to recognize purity as it was for

Re: [go-nuts] Pure functions and Go2

2018-12-14 Thread 'Axel Wagner' via golang-nuts
On Fri, Dec 14, 2018 at 9:51 PM Michael Jones wrote: > There is no absolute reason why a, b, and c could not be evaluated at > compile time. > Being pure is not enough for that. You need at least pure and total - otherwise you could have pure func Foo(x int) int { for {} return x }

[go-nuts] A Numeric Type for Go?

2018-12-14 Thread patrick . bucher87
When programmers complain about the lack of generics in Go, a common mitigation proposed is to use a interface. In many cases, it's possible to find an operation common to all the types to be supported; in the worst case, an empty interface can be used. This doesn't satisfy many Go

[go-nuts] mongodb driver for go

2018-12-14 Thread Badhmanaban M
Hi, is there any native mongodb driver for golang -- 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+unsubscr...@googlegroups.com. For more options,

[go-nuts] Re: Add/Set URL Parameters on the http.Request struct

2018-12-14 Thread tevin
Thank you very much -- 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+unsubscr...@googlegroups.com. For more options, visit

Re: [go-nuts] A Numeric Type for Go?

2018-12-14 Thread Burak Serdar
On Fri, Dec 14, 2018 at 11:00 AM wrote: > > When programmers complain about the lack of generics in Go, a common > mitigation proposed is to use a interface. In many cases, it's possible to > find an operation common to all the types to be supported; in the worst case, > an empty interface can

[go-nuts] Re: mongodb driver for go

2018-12-14 Thread scott.lhommedieu via golang-nuts
Hi, There is a driver available here . It has recently reached a beta release and the team is looking for input and feedback. Also, head over to the MongoDB GO Driver google group to

Re: [go-nuts] Plan9 reborn as a guest OS atop of Golang runtime

2018-12-14 Thread ct via golang-nuts
Michael, Thanks for mentioning Biscuit. I saw the paper a while back and have been toying with the idea of combining it it with the GoKrazy userland ( https://gokrazy.org/) to produce a small, pure-Go OS of some kind. Best regards, Charlton Trezevant On Monday, December 10, 2018 at 9:24:43

[go-nuts] json and interface unmarshalling

2018-12-14 Thread Darko Luketic
Hello, I'm sending messages over websocket. I have a "generic" MessageRequest and MessageResponse struct. type MessageRequest struct { Typestring `json:"type"` Payload interface{} `json:"payload"` } type MessageResponse struct { Typestring `json:"type"` Payload