[go-nuts] Re: Rune-by-rune through a stream

2016-11-05 Thread mark
The io package has the RuneReader interface. You can wrap a generic io.Reader in a bufio.Reader or if you already have a string or byte slice, you can use strings.Reader or bytes.Reader respectively, to get a RuneReader. On Saturday, November 5, 2016 at 10:40:34 PM UTC-7, so.q...@gmail.com wrote:

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-11-05 Thread Nigel Tao
On Tue, Oct 25, 2016 at 9:30 PM, roger peppe wrote: > Would there be some advantage in making the Rasterizer > types in shiny/iconvg and image/vector somewhat more > uniform in the types they use? For example, vector.Rasterizer > seems to use f32.Vec2 pairs everywhere, but iconvg.Rasterizer > uses

[go-nuts] My Computer compiles go slower than my friends worse laptop

2016-11-05 Thread Dave Cheney
What is the exact command you and your friend are using to build your project? -- 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...@googlegroup

[go-nuts] My Computer compiles go slower than my friends worse laptop

2016-11-05 Thread gkolampas
My friends wh ouses a i5 6200 intel dell xps laptop compiles our project in 1.4s While my desktop that has a i7 6700k intel take 6 seconds. I have 16gb of ram and sdd only so what gives? here is my go env set GOARCH=amd64 set GOBIN=C:\Users\Something\Documents\CodeProjects\Go\bin set GOEXE=.exe s

[go-nuts] Rune-by-rune through a stream

2016-11-05 Thread Tamás Gulácsi
bufio.Reader is just buffering reads, it won't make sure the full rune is read. bufio.Scanner is a general purpose reading machinery. It has prebuilt functions to make it spit out chunks separated by EOL, but you can make one to separate by line boundaries. AFAIK it uses bufio.Reader under the h

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

2016-11-05 Thread Tamás Gulácsi
AFAIK it's a design decision that a plugin cannot be loaded twice. Protect it with a sync.Once, if you can't avoid calling the loader twice. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] Rune-by-rune through a stream

2016-11-05 Thread so . query
Just a thought experiment, but what's the idiomatic way to read rune-by-rune from a stream that represents a string of infinite length? The stream itself can be from std.In or continually generated by a function. Would I use bufio.Scanner or bufio.Reader? I suppose its also possible to use a ch

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

2016-11-05 Thread 'Keith Randall' via golang-nuts
On Saturday, November 5, 2016 at 7:48:27 AM UTC-7, leob...@gmail.com wrote: > > Hey, > > I have a scenario where I need to iterate over (as many as possible) map > entries and send them into a channel. > The operation on the other end of the channel can take a long time, so > sends on the chann

[go-nuts] Re: stop go run from printing "exit status 1"?

2016-11-05 Thread Nate Finch
Cool, thanks, done: https://github.com/golang/go/issues/17813 On Saturday, November 5, 2016 at 8:05:00 PM UTC-4, adon...@google.com wrote: > > > It does seem a little bit arbitrary and contrary to UNIX tool design > principles. It's unlikely that this is a compatibility concern for anyone. > F

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

2016-11-05 Thread Henry
Go also support first-class function which is an idea brought from functional programming. Anyhow, in my opinion, you shouldn't be too dogmatic about a particular paradigm. There are cases that can be solved elegantly using a particular paradigm and there are cases that will lead to further unne

[go-nuts] Re: stop go run from printing "exit status 1"?

2016-11-05 Thread adonovan via golang-nuts
On Friday, 4 November 2016 22:49:17 UTC-4, Nate Finch wrote: > > If the script you run with go run returns a non-zero exit status, go run > prints "exit status N" and itself then returns with exit code 1. > > Now, this seems like a double mistake - first off, the only time go run > should print a

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

2016-11-05 Thread Mateusz Dymiński
I started to play with this new plugin feature and I got some problems when I tried to load two different plugins one by one. If I have first plugin as it was describe in the original post and new one: *Interface:* package processor type Processor interface { Process(text string) } *And implem

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

2016-11-05 Thread Sam Whited
On Sat, Nov 5, 2016 at 2:51 PM, Tong Sun wrote: > The dark voodoo regexp as described here works for many cases. > http://www.perlmonks.org/?node_id=261292 > > But I did found its own limits when trying more samples... Regular expression are, well, regular. This means that they can parse regular

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

2016-11-05 Thread Tong Sun
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 PM, Tong Sun wrote: >> > How to beautify a given XML string in GO?... >> >> ...If all you need is the bulit in indentation you can use >> a

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

2016-11-05 Thread Tong Sun
On Sat, Nov 5, 2016 at 12:26 PM, Sam Whited wrote: > On Fri, Nov 4, 2016 at 4:32 PM, Tong Sun wrote: > > How to beautify a given XML string in GO?... > > ...If all you need is the bulit in indentation you can use > an encoder and its indent method: > > https://godoc.org/encoding/xml#Encoder.Inden

[go-nuts] Re: building rss aggregator (thousands of goroutines sleeps at the same time)

2016-11-05 Thread Viktor Kojouharov
It's quite efficient to have a lot of goroutines. That's how I update the feeds in my aggregator. Though your network interface might not like it if you try to initiate thousands of connections at the same time. On Friday, November 4, 2016 at 11:14:24 PM UTC+2, Marwan abdel moneim wrote: > > i a

Re: [go-nuts] Beautify XML

2016-11-05 Thread Tong Sun
Oh, thank you Sam for both of your points. Each is very valuable to me! Oh, and the third one too. :-) Thanks again! On Sat, Nov 5, 2016 at 12:16 PM, Sam Whited wrote: > I should also state that in this example you could of course just use > MarshalIndent, the point was to show that you could

Re: [go-nuts] Beautify XML

2016-11-05 Thread Sam Whited
On Fri, Nov 4, 2016 at 4:32 PM, Tong Sun wrote: > How to beautify a given XML string in GO? > > The xml.MarshalIndent() only apply to a GO structure, not XML strings. Sorry, third time's the charm. I think I didn't understand what you were asking. If all you need is the bulit in indentation you c

Re: [go-nuts] Beautify XML

2016-11-05 Thread Sam Whited
I should also state that in this example you could of course just use MarshalIndent, the point was to show that you could do it manually if you need more customized formatting. On Sat, Nov 5, 2016 at 11:13 AM, Sam Whited wrote: > On Sat, Nov 5, 2016 at 10:57 AM, Tong Sun wrote: >> So any plan to

Re: [go-nuts] Beautify XML

2016-11-05 Thread Sam Whited
On Sat, Nov 5, 2016 at 10:57 AM, Tong Sun wrote: > So any plan to add beautify a given XML string feature soon? Thx. No, sorry, I was just pointing out that by manipulating a token stream you could probably do it yourself fairly easily. Eg. something like this simple example (most of the error ha

Re: [go-nuts] Beautify XML

2016-11-05 Thread Tong Sun
On Sat, Nov 5, 2016 at 11:39 AM, Sam Whited wrote: > I've been playing around with an XML token stream processing API: > > https://godoc.org/mellium.im/xmlstream > > It's still experimental, and likely to change, but it would probably > be pretty easy to write a transformer that keeps track of ii

Re: [go-nuts] Beautify XML

2016-11-05 Thread Sam Whited
On Fri, Nov 4, 2016 at 4:32 PM, Tong Sun wrote: > How to beautify a given XML string in GO? > > The xml.MarshalIndent() only apply to a GO structure, not XML strings. Aside: Note that the language is called "Go", not "GO". I've been playing around with an XML token stream processing API: https:

[go-nuts] SetDeadline for io.Writer - is this right?

2016-11-05 Thread audrius . butkevicius
Hi, So I have the following: https://play.golang.org/p/dcuhh40DFZ Yet I believe it exposes the following issues: 1. If sendWork is at line 54, it's possible that doWrites will hit line 79, falsely reporting a timeout case due to timing issues. Correct? 2. In case of a real timeout (where the wri

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

2016-11-05 Thread leobalduf
Hey, I have a scenario where I need to iterate over (as many as possible) map entries and send them into a channel. The operation on the other end of the channel can take a long time, so sends on the channel may block for a long time. The map is protected by an RWMutex. The map is also rather b

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

2016-11-05 Thread Simon Ritchie
> Can I say Procedural is better than OO? Better at what? It depends what you are trying to do. The novelist and aeronautical engineer Neville Shute wrote "It has been said an engineer is a man who can do for five shillings what any fool can do for a pound". These days we accept that some eng