[go-nuts] Re: Build problem in Liteide

2018-04-09 Thread rajanichand
Such an old thread.. just came across it as I was looking for something else. May be the original requestor would have become an expert by now. Well, if someone still wants to keep all their source go files in one folder (as a learner or test programs etc) and still be able to run it from Lite

Re: [go-nuts] formatting question/issue

2018-04-09 Thread Tyler Compton
My understanding is that this is a consequence of the semicolon insertion rules Go uses. The Go parser actually uses semicolons internally, but they are inserted before parsing so that the programmer doesn't have to. Semicolons are added to the end of a line if the line ends with: - an identifier

[go-nuts] formatting question/issue

2018-04-09 Thread Alex Dvoretskiy
Hello Golangnuts, Why there is no difference if the last comma exists? {'A', 'B', 'C', 'E'} or {'A', 'B', 'C', 'E',} both are valid. Sometimes it causes little troubles. For example, the second snippet wouldn't compile, because of different formatting. But these two snippets are identical

[go-nuts] Re: After one goroutine completed, does the thread its binded will be destroyed?

2018-04-09 Thread keith . randall
Tamás is right. In the case you show, M1 will pick up G2 and work on it. In general, the M (OS thread) finds another goroutine to run, and if it can't find one it parks itself until more goroutines show up. The code is in src/runtime/proc.go:findrunnable, which calls stopm. We've been contemp

[go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Dave Cheney
Please have a read of my talk on solid from 2016. https://dave.cheney.net/2016/08/20/solid-go-design Tldr: define an interface with the behaviour of the os.File that your function/method expects. -- You received this message because you are subscribed to the Google Groups "golang-nuts" grou

[go-nuts] After one goroutine completed, does the thread its binded will be destroyed?

2018-04-09 Thread Tamás Gulácsi
AFAIK it'll be parked fir another goroutine. -- 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 htt

[go-nuts] Re: Concurrent and blocking data

2018-04-09 Thread matthewjuran
> > 2. What does “concurrent and blocking” mean for a data structure? I think this means they’re asking about a form of concurrent programming where a caller will stop executing (block) while the data structure is accessed by a concurrent path. Non-blocking means the caller can continue witho

[go-nuts] Re: Why isn't os.File an interface?

2018-04-09 Thread Glen Newton
Thanks! Apologies for not doing a quick search for this. Thanks, Glen On Monday, April 9, 2018 at 2:40:19 PM UTC-4, Glen Newton wrote: > > Hello, > > I was wondering why os.File is a struct and not an interface. It does not > expose anything except methods. > > I was wanting to make a mock os.Fi

Re: [go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Paul Jolly
See https://github.com/golang/go/issues/14106 On 9 April 2018 at 19:40, Glen Newton wrote: > Hello, > > I was wondering why os.File is a struct and not an interface. It does not > expose anything except methods. > > I was wanting to make a mock os.File for testing and other purposes, but > it no

[go-nuts] Why isn't os.File an interface?

2018-04-09 Thread Glen Newton
Hello, I was wondering why os.File is a struct and not an interface. It does not expose anything except methods. I was wanting to make a mock os.File for testing and other purposes, but it not being an interface makes this not easy. Unless I am missing something here. Thanks, Glen -- You re

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Alex Efros
Hi! On Mon, Apr 09, 2018 at 08:57:04AM -0700, Paul Lalonde wrote: > The FindReaderSubmatchIndex may need to read arbitrarily far after the end > of the match, so if you want multiple matches you'll need a ReadSeeker and > re-wind to the end of the previous match. Ah, I see. So I should manually

[go-nuts] set ldflags with output of a batch command

2018-04-09 Thread Vignesh R
Hi Gophers, I am trying to version my go application with the timestamp of the build. (e.g) (windows) go build -ldflags "-X main.buildVersion=`getTimestamp.exe`" main.go (Linux) go build -ldflags "-X main.buildVersion=`date -u '+%Y-%m-%d_%I:%M:%S%p'`" main.go But I cannot set the out

[go-nuts] IP RemoteAddr() bug

2018-04-09 Thread josue
Good day to all. I've been working on server and comparing traffic from other servers i've notice that the IP reported by net.Listen is different from what is reported by others servers. The Headers don't have X-Forwarded-For or X-Real-Ip Also my server doesn't implements net/http package. But i'

[go-nuts] After one goroutine completed, does the thread its binded will be destroyed?

2018-04-09 Thread Pelon Lee
Such as above image. After G1 completed, does the M1 will bind with another goroutine or destroyed? If M1 isn't destroyed, what will it do? If I don't describe clear

[go-nuts] Re: Concurrent and blocking data

2018-04-09 Thread Robert Solomon
I would like to know the answers to 2 and 3 I'm a relatively new gopher On Mon, Apr 9, 2018, 12:59 PM Robert Solomon wrote: > I would like to know the answers to 2 and 3 > > I'm a relatively new gopher > >> -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] Concurrent and blocking data

2018-04-09 Thread Robert Solomon
I would like to know the answers to 2 and 3 I'm a relatively new gopher > -- 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.c

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Paul Lalonde
The FindReaderSubmatchIndex may need to read arbitrarily far after the end of the match, so if you want multiple matches you'll need a ReadSeeker and re-wind to the end of the previous match. Paul On Monday, April 9, 2018 at 10:37:31 AM UTC-4, Alex Efros wrote: > > Hi! > > On Mon, Apr 09, 2018

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Paul Lalonde
As Rog says - I need to support arbitrary expressions, and the only case that's really causing grief is /^/. The path of least resistance looks like re-implementing/forking a piece of regexp to manipulate EmptyOp. I'll give it a shot in-place and see what upstreaming brings. Thanks for the

[go-nuts] ANN: Go Israel May Meetup

2018-04-09 Thread Miki Tebeka
Hi All, The Go Israel next meetup will be help on May 2, 2018. Agenda - gRPC by Almog Baku - Embedding other Languages in Go (http://nuclio.io framework) by Miki Tebeka See more at https://www.meetup.com/Go-Israel/events/kjvczlyxhbdb/ See you there, -- Miki -- You received this message becau

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Jan Mercl
On Mon, Apr 9, 2018 at 4:37 PM Alex Efros wrote: > I've just tried it with strings.Reader and found current seek position > after FindReaderSubmatchIndex is in 3 bytes after end of the match: > https://play.golang.org/p/OJT7Ri8ji2C Maybe https://play.golang.org/p/vTXSdmPXZZE -- -j -- You re

Re: [go-nuts] Re: Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Alex Efros
Hi! On Mon, Apr 09, 2018 at 04:09:55AM -0700, Tamás Gulácsi wrote: > A small hack can help: add someting at the beginning of the Reader (with > io.MultiReader) that won't allow the match on the beginning. Try to add "\n" at beginning of the stream and then start regexp with \n instead of ^. If r

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Alex Efros
Hi! On Mon, Apr 09, 2018 at 09:25:02AM +0100, roger peppe wrote: > While we're on the subject, ISTM that FindReaderSubmatchIndex should > really return []int64 not []int. A bit late now though. BTW, is there any good example for FindReaderSubmatchIndex? I've just tried it with strings.Reader and

[go-nuts] Re: Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Tamás Gulácsi
A small hack can help: add someting at the beginning of the Reader (with io.MultiReader) that won't allow the match on the beginning. 2018. április 9., hétfő 6:48:10 UTC+2 időpontban Paul Lalonde a következőt írta: > > A ^ normally matches either the start of string or the start of a new line >

Re: [go-nuts] Flutter and golang

2018-04-09 Thread Linker
You can try to use gopherjs to bind a js/webui UI lib for go. On Fri, Apr 6, 2018 at 12:35 PM, Tong Sun wrote: > Saw a recent discussion on Flutter and golang, which seems to me to be > going the wrong way, because I didn't see the magic word "FIDL > " bei

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread roger peppe
On 9 April 2018 at 09:31, Jan Mercl <0xj...@gmail.com> wrote: > On Mon, Apr 9, 2018 at 6:47 AM Paul Lalonde > wrote: > >> Any advice? > > If regexp cannot solve your task don't use regexp. Write the tiny state > machine by yourself, it should be not too much code. Surely that depends whether Paul

Re: [go-nuts] Concurrent and blocking stack

2018-04-09 Thread roger peppe
A simple-as-possible answer might be something like this https://play.golang.org/p/TO8xoH9gwTF For a good answer, you'd probably want to go into performance trade-offs, runtime constraints and other possible implementations. On 8 April 2018 at 06:05, Xen wrote: > Hi everyone, I have this mock in

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread Jan Mercl
On Mon, Apr 9, 2018 at 6:47 AM Paul Lalonde wrote: > Any advice? If regexp cannot solve your task don't use regexp. Write the tiny state machine by yourself, it should be not too much code. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" gr

Re: [go-nuts] Regexp: Matching a new line but *not* start of string, from a Reader

2018-04-09 Thread roger peppe
On 9 April 2018 at 03:41, Paul Lalonde wrote: > A ^ normally matches either the start of string or the start of a new line > (with the m flag). > I'd like to match only starts of lines, but not starts of strings, ideally > without changing the regexp. > > My source data is in a ReadSeeker, and if