[go-nuts] [ANN] THUMBAI v1.0.0-beta Released! - A Go Mod Repository, Go Vanity and Simple Proxy Server

2018-12-10 Thread Jeevanandam M.
Website: https://thumbai.app Documentation: https://thumbai.app/get-started Your feedback is very valuable. Thanks. Cheers, Jeeva -- 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

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Jason E. Aten
Last but not least, for debugging a value x, this gets you type and value quickly: fmt.Printf("type is %T and value is %#v\n", x, x) On Monday, December 10, 2018 at 8:14:47 PM UTC-6, Mark Volkmann wrote: > > Here is some code that shows a part of what I'm trying to do. >

Re: [go-nuts] Re: pass interface

2018-12-10 Thread David Riley
Ah! No, that is not possible, because interfaces (and other types) are not first-class objects in Go like they are in some other languages (such as Python). You can work around it, to some extent, by passing a zero-valued instance of such an interface (e.g. PrintInterface(A{})) and using some

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

2018-12-10 Thread Jason E. Aten
check out/related: https://github.com/Harvey-OS/harvey which is a modern 64-bit descendant of plan9. While not written in Go itself, it does support Go according to https://harvey-os.org/2016/10/20/go-programming-language-on-harvey.html http://lsub.org/ls/clive.html used a modified version of

Re: [go-nuts] Generics

2018-12-10 Thread Ian Denhardt
It would be easier to help if you gave us a more concrete picture of what you're trying to achieve; if there were a nice drop-in alternative to generics in all circumstances already in the language, we probably wouldn't be talking about adding them in the first place :P. Quoting Tharaneedharan

[go-nuts] Generics

2018-12-10 Thread Tharaneedharan Vilwanathan
Hi All, I have a quick question. What is the best choice for writing generic code till Go officially supports generics? Just looking for some guidance. Regards dharani -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Dan Kortschak
Nice is a very strong word. This is the alternative approach that doesn't require a value: https://play.golang.org/p/FoA-GHcr56s (now to the whole list) On Tue, 2018-12-11 at 10:39 +0800, Huiqiang Li wrote: > Nice! i think this is the right answer. > > Dan Kortschak 于2018年12月11日周二 上午10:34写道:

Re: [go-nuts] How to build gollvm on arm platform

2018-12-10 Thread morefun . fang
@Than, Thank you for your detailed answer. I am interested in contributing code to enable ARM port. I plan to spend some times on learning gofrontend firstly, then the bridge. What I want to learn about are 1, Is there any arch-specific code/IR in gofrontend? 2, What's the missing to support

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
Thanks so much Dan! --- R. Mark Volkmann Object Computing, Inc. > On Dec 10, 2018, at 8:34 PM, Dan Kortschak wrote: > > https://play.golang.org/p/VWPb_AcgUrl > >> On Mon, 2018-12-10 at 20:14 -0600, Mark Volkmann wrote: >> Here is some code that shows a part of what I'm trying to do. >>

[go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread Jason E. Aten
For full, actual python inside Go, one could combine: (a) https://github.com/iodide-project/pyodide has the python scientific stack compiled to wasm (python + numpy + scipy + numplotlib) and (b) either https://github.com/go-interpreter/wagon or https://github.com/perlin-network/life: each

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Dan Kortschak
https://play.golang.org/p/VWPb_AcgUrl On Mon, 2018-12-10 at 20:14 -0600, Mark Volkmann wrote: > Here is some code that shows a part of what I'm trying to do. > https://goplay.space/#8piYtjsqveZ > > package main > > import ( > "fmt" > "reflect" > ) > > type Shape interface { > Area() float64 >

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
Here is some code that shows a part of what I'm trying to do. https://goplay.space/#8piYtjsqveZ package main import ( "fmt" "reflect" ) type Shape interface { Area() float64 Rotate(angle float64) Translate(x, y float64) } func ReportInterface(intfPtr interface{}) { fmt.Println("type is",

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Robert Engels
Well, you can switch on a type, so you would think the case expression might be able to be used elsewhere. Since the types can be created at runtime via reflect it would seem you should be able to get a reference to the compile time type definition as well. Seems logical to me. > On Dec 10,

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Dan Kortschak
Oh! Yeah, that's never going to work. How could it? On Mon, 2018-12-10 at 13:43 -0800, Tyler Compton wrote: > If my interpretation of the question is correct, I think it boils > down to > whether or not it's possible to get the reflect.Type of a type in > order to > pass it to a function without

Re: [go-nuts] timeout with bufio.Scanner & Scanner.Scan()

2018-12-10 Thread robert engels
You need to use multiple go routines and channels - one routine calls Scan() and when it gets the result it writes it to a channel, then the reader can timeout on the channel. > On Dec 10, 2018, at 4:26 PM, Trig wrote: > > I'm currently reading ASCII data from a serial port using the

[go-nuts] timeout with bufio.Scanner & Scanner.Scan()

2018-12-10 Thread Trig
I'm currently reading ASCII data from a serial port using the bufio.Scanner (since what's coming back is a line at a time, it's convenient w/ reading using the Scanner.Text()). Problem is, the for loop I use to process the reads lock at the Scanner.Scan() call. Is there a to implement some

Re: [go-nuts] \n new line feed

2018-12-10 Thread Ian Lance Taylor
On Sun, Dec 9, 2018 at 10:19 AM 伊藤和也 wrote: > > In fmt.Println function, \n is used. Is \n safe to use in different platforms? Yes. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Ian Lance Taylor
On Mon, Dec 10, 2018 at 1:43 PM Tyler Compton wrote: > > If my interpretation of the question is correct, I think it boils down to > whether or not it's possible to get the reflect.Type of a type in order to > pass it to a function without first creating an instance of that type. I > don't

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Tyler Compton
If my interpretation of the question is correct, I think it boils down to whether or not it's possible to get the reflect.Type of a type in order to pass it to a function without first creating an instance of that type. I don't think it's possible but I would be interested to hear from someone who

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Dan Kortschak
No, it is possible, but you need to pass the pointer to the interface. You can then use reflect to interrogate the interface value. The bigger question, and one that would help here would be what is it that you are actually trying to achieve. On Mon, 2018-12-10 at 08:53 -0600, Mark Volkmann

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

2018-12-10 Thread Michael Jones
oops. left out a key link: https://github.com/mit-pdos/biscuit On Mon, Dec 10, 2018 at 1:23 PM Michael Jones wrote: > Read about Biscuit: > https://pdos.csail.mit.edu/papers/biscuit.pdf > > https://www.usenix.org/sites/default/files/conference/protected-files/osdi18_slides_cutler.pdf > > This

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

2018-12-10 Thread Michael Jones
Read about Biscuit: https://pdos.csail.mit.edu/papers/biscuit.pdf https://www.usenix.org/sites/default/files/conference/protected-files/osdi18_slides_cutler.pdf This is encouraging--smart people making the most of Go in a new area, as it is today, without an active iterative feedback loop.

Re: [go-nuts] How to build gollvm on arm platform

2018-12-10 Thread 'Than McIntosh' via golang-nuts
Hello, As things stand, gollvm isn't usable for Arm (32 or 64); the cmake error you are hitting is intentional. The main obstacle for enabling Arm is enhancing the Gollvm bridge to support the Arm ABI, e.g. the rules for passing parameters (in memory vs register) depending on the signature of

Re: [go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread Nate Finch
Justin got this 100% correct. Starlight and Starlark are not intended to be used to just run existing python code. there's a ton they don't support, so pretty much any non-trivial python program would not be compatible. It's really more of a way to give users the ability to write small to

[go-nuts] Re: Go 1.11.1 is released

2018-12-10 Thread amank8686
Can you please share what you did to clear everything out, I am running into the same issue. Did you uninstall and reinstall? On Tuesday, October 2, 2018 at 2:29:08 PM UTC-5, sc28 wrote: > > My bad -- > > Had installs in both /usr/local/bin and /usr/local/bin/go -- cleared > everything and

[go-nuts] How to build gollvm on arm platform

2018-12-10 Thread morefun . fang
I try to compile gollvm on arm platform according to https://go.googlesource.com/gollvm/, but error is reported as following CMake Error at tools/gollvm/cmake/modules/GoVars.cmake:12 (message): Arch aarch64 not yet supported https://go.googlesource.com/gollvm/ tells that Gollvm is currently

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

2018-12-10 Thread Dmitry Ponyatov
Can Plan9 reborn as a *guest* OS atop of Golang runtime? Maybe somebody works on a clustering system can expand Go runtime to natively and transparently run over Beowulf-style message passing clusters? -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread Raffaele Sena
If you want a full python interpreter, you should look at https://github.com/go-python/gpython, but gpython also doesn't have a full standard library implemented. -- Raffaele On Mon, Dec 10, 2018 at 1:58 AM Justin Israel wrote: > > > On Mon, Dec 10, 2018, 9:39 PM wrote: > >> >> >> On Friday,

Re: [go-nuts] Re: pass interface

2018-12-10 Thread Mark Volkmann
Yes, this is what I'm trying to do! Perhaps this is not possible. On Sun, Dec 9, 2018 at 10:34 PM Robert Engels wrote: > I think what the OP wants is: > > type A interface{} > type B interface{} > > ... > PrintInterface(A) > > Meaning they want to pass the interface definition to some method. >

Re: [go-nuts] Is there a good approach to abstraction of DB access including transactions and forupdate?

2018-12-10 Thread Robert Engels
Distributed transactions are difficult in cloud computing. See GCP Spanner. Also read up on “saga” pattern. If you have multiple sources participating in the transaction, saga seems to be the preferred method for highly scalable solutions. > On Dec 10, 2018, at 8:55 AM, bonpi bonpi wrote: >

[go-nuts] Is there a good approach to abstraction of DB access including transactions and forupdate?

2018-12-10 Thread bonpi bonpi
I would like to abstract DB access of certain server programs like GCP bookshelf sample. However, in this example transactions are not handled. https://github.com/GoogleCloudPlatform/golang-samples/tree/master/getting-started/bookshelf When dealing with transactions, adding APIs to the interface

[go-nuts] Re: invalid recursive type alias

2018-12-10 Thread 'Bryan Mills' via golang-nuts
The compiler is behaving as designed in both cases. See https://golang.org/issue/25187 (and the associated https://golang.org/issue/25141). On Saturday, December 8, 2018 at 12:33:48 PM UTC-5, Jan Mercl wrote: > > This code compiles fine > > package main > > type node

Re: [go-nuts] Http server, async tasks and gracefully shutdown.

2018-12-10 Thread Robert Engels
>From the docs: Note that calls with a positive delta that occur when the counter is zero must happen before a Wait. Calls with a negative delta, or calls with a positive delta that start when the counter is greater than zero, may happen at any time. Typically this means the calls to Add

[go-nuts] Http server, async tasks and gracefully shutdown.

2018-12-10 Thread Jérôme LAFORGE
Hello World, In order to manage async tasks with callback on http , I have to reply to my customer for example with 202 Accepted, and keep some works with a new goroutine. I habitually use server.Shutdown() and sync.Waitgroup in order to gracefully shutdown the application when all requests

Re: [go-nuts] Re: navigating through interface calls

2018-12-10 Thread Robert Engels
When using IntelliJ, did you restrict the search to “project files”? Otherwise you will get implantations anywhere in the standard library or other projects. > On Dec 10, 2018, at 6:21 AM, David Wahlstedt > wrote: > > Hi, and thanks for your answers! > Yes, I realize that the possible

[go-nuts] Re: navigating through interface calls

2018-12-10 Thread David Wahlstedt
Hi, and thanks for your answers! Yes, I realize that the possible results of calling an interface method depends on runtime. But in many cases there is only one possible alternative, or just a few ones, dependent of the state of the program. It should still be possible for the tool to compute

Re: [go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread Justin Israel
On Mon, Dec 10, 2018, 9:39 PM wrote: > > > On Friday, December 7, 2018 at 9:05:02 PM UTC+1, Nate Finch wrote: >> >> I’d like to announce starlight - >> https://github.com/starlight-go/starlight. >> >> >> Starlight wraps google’s Go implementation of the starlark python dialect >>

[go-nuts] Re: Starlight - run python inside Go to extend your applications - easily

2018-12-10 Thread michal
On Friday, December 7, 2018 at 9:05:02 PM UTC+1, Nate Finch wrote: > > I’d like to announce starlight - https://github.com/starlight-go/starlight > . > > > Starlight wraps google’s Go implementation of the starlark python dialect > (most notably found in

Re: [go-nuts] I want to set the position of the window in GUI display of golang

2018-12-10 Thread kato masa
thank you for the advice! 2018年12月5日水曜日 12時26分03秒 UTC+9 Robert Engels: > > You should probably file an issue at > > http://github.com/lxn/walk > > They don’t seem to have a community forum, but I think the author could > help you easily. Also you could try stack overflow as there are a few >