[go-nuts] Re: ActiveState seeking Go community feedback

2016-11-07 Thread jeffr
Thanks for the replies Nate and Tong. We've helped out on packaging for all of our languages in the past, so that might be a place where we can help. We bring a number of strengths to the table that will feature in our distros. We build for all manner of platforms and we will provide the most

Re: [go-nuts] Question on cmd/asm

2016-11-07 Thread Ian Lance Taylor
On Mon, Nov 7, 2016 at 8:58 PM, wrote: > I've been trying out Go's assembler, but I can't seem to get the most basic > program to compile. Following the example on https://goroutines.com/asm, > which introduces go's assembler through an example of an add function on > amd64,

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-07 Thread andrew_chambers
I imagine the new SSA backend can do this with its pattern matching, but you would need to look for it here: https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/generic.rules or https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/AMD64.rules Maybe

[go-nuts] Re: Is it possible to bundle LuaJIT binary together with Go executable?

2016-11-07 Thread andrew_chambers
There are a few ways to embed binary data inside a Go executable, mainly using go generate to create a const byte slice. At runtime you could then extract the binary, though this probably might make some anti virus products mad at you. On Tuesday, November 8, 2016 at 2:38:48 PM UTC+13, ChrisLu

[go-nuts] Is it possible to bundle LuaJIT binary together with Go executable?

2016-11-07 Thread Tamás Gulácsi
If you can extract ti som temp dir, then sure. Otherwise, I don't know how could you start an executable in memory... -- 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

Re: [go-nuts] Slow 64 bit integer division on amd64

2016-11-07 Thread radu
Sorry to revive an old thread. One thing to note is that dividing a 64-bit by a 32-bit is much faster than dividing a 64-bit by a 64-bit, at least on recent Intel platforms. Unfortunately there is no valid way to express that kind of calculation in Go.. Is the compiler/optimizer smart enough

[go-nuts] Question on cmd/asm

2016-11-07 Thread aindurti
I've been trying out Go's assembler, but I can't seem to get the most basic program to compile. Following the example on https://goroutines.com/asm, which introduces go's assembler through an example of an add function on amd64, I get the compile error: # github.com/smasher164/asmtest

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Kaylen Wheeler
Keep in mind: at this point, I'm only playing around with a Go implementation. What I'm trying to do is implement an Entity-Component-System. Each entity consists of a collection of components, each of which may have a different type. The first thing I'm trying to implement is an easy way to

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread mhhcbon
is this what you are looking for ? https://play.golang.org/p/_g2AbX0yHV see also the related so for what I fund interesting http://stackoverflow.com/questions/40060131/reflect-assign-a-pointer-struct-value On Tuesday, November 8, 2016 at 4:07:56 AM UTC+1, Kaylen Wheeler wrote: > > Here's what I

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Edward Muller
Based on that example, I'm even more confused about what you are trying to accomplish. Can we take a step back and forget about the implementation of a solution and describe the problem you are working on? On Mon, Nov 7, 2016 at 19:08 Kaylen Wheeler wrote: > Here's what I

[go-nuts] Is it possible to bundle LuaJIT binary together with Go executable?

2016-11-07 Thread ChrisLu
Hi, I am working on a project to start a LuaJIT process from Go. My question is whether it is possible to bundle LuaJIT binary together with Go executable? If having this, this would avoid the external dependency to install LuaJIT. Chris -- https://github.com/chrislusf/gleam

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Florin Pățan
I think that you want to write generic code in a language that doesn't have generics. Also, the description of the problem is incorrect. You describe how you want to solve the problem, my using pointers or changing the fields of structs, but you never describe the actual problem, how did you

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Kaylen Wheeler
I want pointers because I want most components to be structs, and I want the ability to modify the fields in those structs. On Monday, 7 November 2016 16:46:17 UTC-8, freeformz wrote: > > Why do you want to use pointers? > > On Mon, Nov 7, 2016 at 4:42 PM Kaylen Wheeler >

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Edward Muller
Then just use pointers (see lines 45+): https://play.golang.org/p/vl47WDHOdN On Mon, Nov 7, 2016 at 4:50 PM Kaylen Wheeler wrote: I want pointers because I want most components to be structs, and I want the ability to modify the fields in those structs. On Monday, 7

[go-nuts] Re: Concurrent SQL queries with PG

2016-11-07 Thread Mandolyte
Thanks for the quick response. and for your book - one of the best I've ever purchased! To close the loop, optimal number of go routines is about 10 and the database is actually Greenplum, a massively parallel processing architecture based on an early fork of PG ... YMMV On Monday, November

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Edward Muller
Why do you want to use pointers? On Mon, Nov 7, 2016 at 4:42 PM Kaylen Wheeler wrote: > Thanks for the "basic pattern" example here. There's one little > modification I'm wondering about. > > Can this line: > > rv.Elem().Set(m[rv.Type()]) > > be changed to this? > >

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Edward Muller
This was also my swag at an example: https://play.golang.org/p/QG7g9veKEI PS: it's still not strictly "type safe". On Mon, Nov 7, 2016 at 4:46 PM Edward Muller wrote: > Why do you want to use pointers? > > On Mon, Nov 7, 2016 at 4:42 PM Kaylen Wheeler

[go-nuts] Re: marshall/unmarshall of large json files

2016-11-07 Thread Ugorji Nwoke
golang's encoding/json package likes to ensure that the 1. you read 12MB into memory 2. encoding/json will first scan the full text to ensure it is a well-formed json (before populating the structure) 3. At a later point, GC will reclaim that memory 4. This means that if each GET request is

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Michael Jones
Oh, I did not understand it that way. The clarified point is certainly true. Inherently true in the sense of a tautology—“When we use mechanisms that delay type testing until runtime then we will not have tested the types before runtime.” Q.E.D. From: on

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Dan Kortschak
Thank you Michael for that. I have written a small package to help with this kind of uncertainty :) https://play.golang.org/p/vSnG-HGdrU On Mon, 2016-11-07 at 16:08 -0800, Michael Jones wrote: > Not precisely so…Interfaces, and type switches, and related > mechanisms are safe. Their type

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Michael Jones
Not precisely so…Interfaces, and type switches, and related mechanisms are safe. Their type indeterminism is protected from the program and their concretization is much like Schrodinger’s box…the interface is any type until you look at it through a type switch or type dereferencing…then it is a

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Edward Muller
FWIW: As soon as interface{} is involved you are no longer "type safe". On Mon, Nov 7, 2016 at 2:56 PM Kaylen Wheeler wrote: > So, what I'm trying to accomplish is a little unusual, and may need some > explanation. > > Basically, I'm trying to find a typesafe way to access

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread adonovan via golang-nuts
On Monday, 7 November 2016 17:55:57 UTC-5, Kaylen Wheeler wrote: > > I'm trying to find a typesafe way to access a type-indexed map of > components. This map can contain objects of any type, and the keys are > reflect.Type. > > One strategy I thought may work would be to pass a pointer to a

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Kaylen Wheeler
So, what I'm trying to accomplish is a little unusual, and may need some explanation. Basically, I'm trying to find a typesafe way to access a type-indexed map of components. This map can contain objects of any type, and the keys are reflect.Type. One strategy I thought may work would be to

[go-nuts] Re: Concurrent SQL queries with PG

2016-11-07 Thread adonovan via golang-nuts
On Monday, 7 November 2016 16:57:29 UTC-5, Mandolyte wrote: > > I have what amounts to a recursion problem and I wrote a minimal test > using go routines. I am able to vary the max number of go routines as a > parameter on the command line (*). But the times don't vary much whether a > single

[go-nuts] Concurrent SQL queries with PG

2016-11-07 Thread Mandolyte
I have what amounts to a recursion problem and I wrote a minimal test using go routines. I am able to vary the max number of go routines as a parameter on the command line (*). But the times don't vary much whether a single go routine is used or 50 are used. I get the correct results, no matter

[go-nuts] Re: TLS False Start?

2016-11-07 Thread Igor Gatis
Say you have thousands of devices which you have control over. They all use GPRS (2G), with ~700ms of latency. TLS handshake may cost ~4s sometimes when mobile coverage is good and astonishing 20s when it is not or packet loss is high by any reason. False Start could make a huge difference.

[go-nuts] Re: marshall/unmarshall of large json files

2016-11-07 Thread Ugorji Nwoke
Show some code, and we may be able to advise you better. On Monday, November 7, 2016 at 1:26:49 PM UTC-5, gmuth...@gmail.com wrote: > > We are using Go for one of our projects and our API's use JSON as the > payload formatter. We have a large json file (12MB) that needs to be > unmarshalled.

Re: [go-nuts] Re: XML Beautifier that doesn't rewrite the document

2016-11-07 Thread Tong Sun
On Sun, Nov 6, 2016 at 5:35 PM, Tong Sun wrote: > > On Saturday, November 5, 2016 at 3:51:55 PM UTC-4, Tong Sun wrote: >> >> >> On Saturday, November 5, 2016 at 3:42:27 PM UTC-4, Tong Sun wrote: >>> >>> >>> On Sat, Nov 5, 2016 at 12:26 PM, Sam Whited wrote: >>> On Fri, Nov 4, 2016 at 4:32

Re: [go-nuts] godoc: display a full file example

2016-11-07 Thread mhhcbon
Thanks, a lot! Working now. On Monday, November 7, 2016 at 9:17:00 PM UTC+1, Jan Mercl wrote: > > > On Mon, Nov 7, 2016 at 9:08 PM wrote: > > > Can someone highlight my mistake ? > > "The entire test file is presented as the example when it contains a > single example

Re: [go-nuts] godoc: display a full file example

2016-11-07 Thread Jan Mercl
On Mon, Nov 7, 2016 at 9:08 PM wrote: > Can someone highlight my mistake ? "The entire test file is presented as the example when it contains a single example function, at least one other function, type, variable, or constant declaration, and no test or benchmark functions.

[go-nuts] godoc: display a full file example

2016-11-07 Thread mhhcbon
Hi, I m having some troubles to display a full file example in godoc, like sort package does here https://godoc.org/sort#example-Ints. In godoc my example displays only the content of the Example_* method, but I want to display the whole file.

Re: [go-nuts] Concurrently read map entries into a channel

2016-11-07 Thread Jesper Louis Andersen
On Sat, Nov 5, 2016 at 3:47 PM wrote: > > The map is also rather big and I want to avoid creating a temporary copy > of it. > > > In Erlang, you have a call on ETS tables called ets:safe_fixtable(Table, Fix). This makes the table safe for traversal until you remove the fix

[go-nuts] marshall/unmarshall of large json files

2016-11-07 Thread gmuthuswamy
We are using Go for one of our projects and our API's use JSON as the payload formatter. We have a large json file (12MB) that needs to be unmarshalled. We just used the standard json enconde/decode and it bloats up the memory. I ran the pprof an realized it was due to reflect_unsafe.NewArray

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-07 Thread Ian Lance Taylor
On Mon, Nov 7, 2016 at 12:57 AM, wrote: > All above discussion is talking about cpu excution order or memory order, > lets make it easy and clear. > If I use a mutex when create a temporary map to guarantee that this > temporary map has been successully created, modified and

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Pietro Gagliardi
The same explanation that applies to slices of interfaces (https://golang.org/doc/faq#convert_slice_of_interface ) applies to pointers to interfaces. You shouldn't need a pointer to interface anyway; what are you trying to do? > On Nov 7,

[go-nuts] Re: Noob question: Pointers to interfaces

2016-11-07 Thread mhhcbon
I can t detail the details, but just use interface{} package main import ( "fmt" ) type MyStruct struct { a int b int } func myFunc(p interface{}) { fmt.Printf("Here is the type: %T\n", p) } func main() { var m *MyStruct myFunc() myFunc(MyStruct{}) } On Monday,

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-07 Thread ayrb13
All above discussion is talking about cpu excution order or memory order, lets make it easy and clear. If I use a mutex when create a temporary map to guarantee that this temporary map has been successully created, modified and set to gMap1. Is it safe setting gMap1 pointer to gMap pointer when

[go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Kaylen Wheeler
I'm new to Go, and I'm still trying to figure it out. I'm trying to write a function that takes a pointer to a pointer of any type. I tried writing it like this: type MyStruct struct { a int b int } func myFunc(p **interface{}) { fmt.Printf("Here is the type: %T\n", p) } func main() {

[go-nuts] Re: With GO - Can I say Procedural is better than OO?

2016-11-07 Thread 'Eric Johnson' via golang-nuts
On Saturday, September 24, 2011 at 9:14:22 AM UTC-7, nvcnvn wrote: > > I just read here: > http://golang.org/doc/go_faq.html#Is_Go_an_object-oriented_language > And all of the GO example we have is not writen in OOP way. > So can I say that GO see the benefit of Procedural over OO!? >

[go-nuts] Go+Windows+Audio

2016-11-07 Thread Dmitry Shumkov
Hi all. I've tried to get access to Windows audio from Go program but failed. That I did below: 1. Downloaded and built Portaudio (it's open audio I/O library http://portaudio.com/). So I've built that with Visual Studio and got .dll file. 2. Downloaded Go wrapper for Portaudio - (

Re: [go-nuts] Mongo Query from GO

2016-11-07 Thread Shawn Milochik
I don't think that's a Go question. Check the Mongo command docs: https://docs.mongodb.com/v3.2/reference/command/nav-crud/ Search for "Query and Write Operation Commands" on the page. I think you're using "set" instead of "uddate." -- You received this message because you are subscribed to

[go-nuts] Re: Beautify XML

2016-11-07 Thread 'Eric Johnson' via golang-nuts
On Friday, November 4, 2016 at 2:32:24 PM UTC-7, Tong Sun wrote: > > How to beautify a given XML string in GO? > As someone who has spent a fair amount of time in the complexities of XML, it is worth noting that XML is not equivalent to JSON in the context of your question. Only with a

[go-nuts] Re: Get variables names

2016-11-07 Thread roman
// p.Query is "select * from o_settings('get_by_id', '{"id":8,"changes":null,"search_criteria":null}');" logme(p.Query()) // you see in console: //LOGME: p.Query() = "select * from o_settings('get_by_id', '{"id":8,"changes":null,"search_criteria":null}');" // func logme(nup string) { //for

[go-nuts] HTTP/2 PING

2016-11-07 Thread Simon Griffiths
Hi, I am struggling making a HTTP/2 ping request using the HTTP2 package "golang.org/x/net/http2". I am making a get request over HTTP/2 but using the HTTP client from the "net/http" package as below. Are there any examples of how to use ping and make a http POST request using the

Re: [go-nuts] Multiple-reader single-writer map access is safe ?

2016-11-07 Thread Asit Dhal
Hi, the second one is better. The lock should only protect the shared data. In this case, gMap. In the first case, you are protecting some computations which are not accessing any shared data. On November 7, 2016, at 4:03 AM, 刘桂祥 wrote:     should I use ??    

[go-nuts] Mongo Query from GO

2016-11-07 Thread Syed Qasim Rizvi
Hi All, I am having problem while updating MongoDB using GO. I used the below format for the query :- update := bson.M{ "$set": bson.M{ "reputation": newRepOld, "smtp_send_limit": quota, "last_cron_time": currentCronTime, "plain_text": 0, "smtp_count": bson.M{ "domain_stats":

[go-nuts] Http Server read/write timeout [GoLang version 1.7]

2016-11-07 Thread wolfgang . friedl
Hi everyone! I've implemented a simple HTTP server using some timeout values for read and write. I was expecting that if the timeout is reached the server closes the connection and sending an 408 (REquest timeout) status code. I also assumed that in the header "Connection": close is set. What

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-11-07 Thread Morgan Hein
Thanks, found this and fixed it. On Thursday, October 13, 2016 at 5:06:46 PM UTC-7, hiatt@gmail.com wrote: > > Not sure if it's intended behavior, but you are using defer conn.Close() > inside of an infinite for loop which means the conn never closes. > > On Thursday, October 13, 2016 at

[go-nuts] Re: Increasing memory usage from Gob, references never lost

2016-11-07 Thread Morgan Hein
Hey Robert, Late reply for anyone finding this via google later, but the issue you mentioned was the exact problem I was having. I just copied out the fields I wanted to keep and lost the reference to the original device, and this solved the memory increasing issue. On Thursday, October 13,

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-07 Thread Mateusz Dymiński
Works! What a strange behavior... I'll create the issue - or even two on the github later today. Thanks Sebastien for your help! W dniu poniedziałek, 7 listopada 2016 12:58:52 UTC+1 użytkownik Sebastien Binet napisał: > > > > On Mon, Nov 7, 2016 at 12:44 PM, Seb Binet

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-07 Thread Seb Binet
On Mon, Nov 7, 2016 at 12:44 PM, Seb Binet wrote: > > > On Sun, Nov 6, 2016 at 8:21 PM, Mateusz Dymiński > wrote: > >> I haven't played with the plugin feature yet, but some things stand out >>> to me about your code and I wonder if it is correct or not.

Re: [go-nuts] plugin - How to open and lookup for interface implementation

2016-11-07 Thread Seb Binet
On Sun, Nov 6, 2016 at 8:21 PM, Mateusz Dymiński wrote: > I haven't played with the plugin feature yet, but some things stand out to >> me about your code and I wonder if it is correct or not. >> Is there a difference in using go build vs go run, in the same way as you >> can

Re: [go-nuts] Re: printf in color

2016-11-07 Thread 'Anmol Sethi' via golang-nuts
I wrote a similar library once https://github.com/nhooyr/color But I like your approach better because you can just use fmt.Printf On Sun, Nov 6, 2016 at 10:07 PM 'Константин Иванов' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hello. I wrote the library that allows to use

[go-nuts] Re: printf in color

2016-11-07 Thread gary . willoughby
https://godoc.org/?q=terminal+color On Friday, 1 February 2013 23:02:04 UTC, Constantine Vassilev wrote: > > I am printing a lot lines in command line during testing. > Visualizing using a color would be great. > > Are there a way to send color related commands to the terminal using* > printf*?