Re: [go-nuts] Trouble with exiting a for loop that contains bufio.NewScanner.Scan()

2018-12-30 Thread Michael Jones
You are ignoring an important situational fact...the serial port is not an infinite stream to you, but a sequence of serial ports divided by connection closings. In this situation, the thing to be scanned is experiencing EOF at close events but this is not being communicated. That is the problem.

Re: [go-nuts] Trouble with exiting a for loop that contains bufio.NewScanner.Scan()

2018-12-30 Thread Trig
When reading from a serial port, there is no EOF between data sets. I may have to use something else besides a scanner to do this. I have a handler function called by a goroutine that just monitors incoming data in a for loop and sends that data coming in back through a channel. If the

Re: [go-nuts] Trouble with exiting a for loop that contains bufio.NewScanner.Scan()

2018-12-30 Thread Wagner Riffel
Scan() returns false when it reaches EOF or an error, so with what you provided i assume you're missing to check that. for ns.Scan() { ... } or for { if !ns.Scan() { break } -wgr On Sun, Dec 30, 2018 at 10:36 PM Trig wrote: > > I'm currently utilizing the bufio.NewScanner to read ASCII

[go-nuts] Trouble with exiting a for loop that contains bufio.NewScanner.Scan()

2018-12-30 Thread Trig
I'm currently utilizing the bufio.NewScanner to read ASCII data from a serial port. I have the following simple code: ns := bufio.NewScanner(sPort) for { ns.Scan() if ns.Text() != "" { // ignore blank lines // handle content here } } The problem is ns.Scan() blocks the loop

Re: [go-nuts] Re: Announcing a Fyne GUI toolkit

2018-12-30 Thread Andrew Williams
Hi, For anyone still interested in this project but held back by the EFL build or runtime dependency then I have good news: * Our new default driver does not rely on additional libraries * :) We have moved to an OpenGL driver - using go-gl and glfw so all you need is the system libraries - and

[go-nuts] [ANN] delivery for extending Google Takeout for Google+ Communities posts

2018-12-30 Thread Dan Kortschak
I wanted to be able to archive the posts from the go.science Google+ community. So I have made a pico tool that will do this, packaging up the posts and JSON manifest into a zip when given the metadata from Takeout. The tools is available here: https://github.com/kortschak/delivery It requires

[go-nuts] Re: go for robotic control, walking balance, quad flight control

2018-12-30 Thread Laurent Moussault
It's easy to use Go on the Raspberry Pi (with or without cross-compilation), and AFAIK you can gain low-level access to the hardware in almost the same way than in C. For example, you can use all the features of the GPIO by mmap-ing the registers dedicated to its control (under linux the

Re: [go-nuts] Type inference in non-constant shift expressions

2018-12-30 Thread Caleb Spare
On Sun, Dec 30, 2018 at 12:05 PM Ian Lance Taylor wrote: > On Sat, Dec 29, 2018 at 11:12 PM Caleb Spare wrote: > > > > I noticed the following: > > > > package main > > > > func main() { > > x := float64(1 << 3) // fine (constant expression) > > > > v := uint(3) > > x = float64(1 << v) //

Re: [go-nuts] Type inference in non-constant shift expressions

2018-12-30 Thread Ian Lance Taylor
On Sat, Dec 29, 2018 at 11:12 PM Caleb Spare wrote: > > I noticed the following: > > package main > > func main() { > x := float64(1 << 3) // fine (constant expression) > > v := uint(3) > x = float64(1 << v) // invalid operation: 1 << uint(v) (shift of type float64) > > _ = x > } > > (playground:

Re: [go-nuts] cgo with custom toolchain

2018-12-30 Thread Ian Lance Taylor
On Sat, Dec 29, 2018 at 11:23 PM wrote: > > Any example on how I can build cgo code using custom toolchain? I'm not sure what you are asking. Even with a custom toolchain, can't you just `go build`? If you need to run cgo directly, there are some brief docs for that at the bottom of

Re: [go-nuts] regexp: is there a way to match single byte ?

2018-12-30 Thread Kurtis Rader
On Sat, Dec 29, 2018 at 8:47 PM Michael Jones wrote: > Never use a cannon as a fly swatter. > A regular expression is heavy artillery. > A for-loop will do just fine: smaller, simpler, faster, land ess > dependencies: > A +100 to Michael's reply. Before falling in love with Python ~15 years

[go-nuts] golangbrigde.org is down

2018-12-30 Thread Davor Kapša
golangbridge and all subdomains are gone. Please notify administrators. -- 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.

Re: [go-nuts] regexp: is there a way to match single byte ?

2018-12-30 Thread Michael Jones
I woke up at 2am here bugged about my former reply. Here's version 2... https://play.golang.org/p/lky_W20CKnM ...should have sent this the first time. Sorry! On Sat, Dec 29, 2018 at 9:09 PM Kurtis Rader wrote: > On Sat, Dec 29, 2018 at 8:47 PM Michael Jones > wrote: > >> Never use a cannon

Re: [go-nuts] missing fmt.Error(...interface{})

2018-12-30 Thread Liam Breck
Maybe fmt.Errorf encourages fmt.Errorf("%v %v", false, 42) Or worse fmt.Errorf("error %v %v", false, 42) :-) On Sun, Dec 30, 2018, 1:07 AM Jakob Borg I would suggest that an error should start with a descriptive string. The > existing methods encourage this. A fmt.Error as suggested would

Re: [go-nuts] missing fmt.Error(...interface{})

2018-12-30 Thread Jakob Borg
I would suggest that an error should start with a descriptive string. The existing methods encourage this. A fmt.Error as suggested would not, instead implicitly encouraging things like fmt.Error(false, 42) which is user unfriendly. //jb On 30 Dec 2018, at 09:53, Justin Israel

Re: [go-nuts] missing fmt.Error(...interface{})

2018-12-30 Thread Justin Israel
On Sun, Dec 30, 2018 at 9:26 PM Liam Breck wrote: > Justin, see docs for fmt.Print(...interface{}) > Ah true. I forgot about the whitespace formatting versions. I stand corrected that a fmt.Error would actually perform formatting and would be consistent with Sprint and Print. My only guess now

Re: [go-nuts] missing fmt.Error(...interface{})

2018-12-30 Thread Liam Breck
Justin, see docs for fmt.Print(...interface{}) On Sun, Dec 30, 2018, 12:15 AM Justin Israel > > On Sun, Dec 30, 2018, 7:24 PM Liam Breck wrote: > >> What's the rationale for omission of: >> fmt.Error(a ...interface{}) error >> > > What does it mean for this function to accept a variable

Re: [go-nuts] Using of packages

2018-12-30 Thread Justin Israel
On Sun, Dec 30, 2018, 5:02 PM wrote: > I'm a beginner in Golang and quite confusing about using packages in a > program. For example, every non simple software has a bunch of classes and > interfaces or utility classes which are usually lokated in different > packages in the same program. So

Re: [go-nuts] missing fmt.Error(...interface{})

2018-12-30 Thread Justin Israel
On Sun, Dec 30, 2018, 7:24 PM Liam Breck wrote: > What's the rationale for omission of: > fmt.Error(a ...interface{}) error > What does it mean for this function to accept a variable number of arguments when there is no formatting or printing implied by the name of the function? > Given

Re: [go-nuts] Forking/transfering a repository and import paths

2018-12-30 Thread Sotirios Mantziaris
I will try some of the suggestion in this topic to see what works out. I will open a feature request in the golang repo for forking support. On Saturday, December 29, 2018 at 6:56:32 AM UTC+2, Nathan Fisher wrote: > > TLDR > > > Is it possible to fork a repo and change the import path of the >