[go-nuts] How to pass a go file name as arguments to go run

2017-01-05 Thread Mandolyte
Pass as a value to a named argument: go run cmd/main.go -input tests/dir/a.go -- 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] Re: how go cast multi return value type

2017-01-05 Thread djadala
On Friday, January 6, 2017 at 4:01:32 AM UTC+2, hui zhang wrote: > > > check code below > func foo() (int32,int32) { > . > } > var a,b int16 > a, b = (int16, int16)foo() > > I want to cast multi return value , but it seems impossible in go, how > can I do that > I just want to make my code

Re: [go-nuts] How can I compare the interface in a generic function

2017-01-05 Thread Ian Lance Taylor
On Thu, Jan 5, 2017 at 5:29 PM, hui zhang wrote: > > How can I compare the interface ? > I want to implement a generic function. > the <=>= report error in this code > > func InRange(a, b, c interface{}) bool { >if c >= a && c <= b { > return true >} else { > return false

Re: [go-nuts] how go cast multi return value type

2017-01-05 Thread Ian Lance Taylor
On Thu, Jan 5, 2017 at 5:24 PM, wrote: > > check code below > func foo() (int32,int32) { > . > } > var a,b int16 > a, b = (int16, int16)foo() > > I want to cast multi return value , but it seems impossible in go, how can > I do that > I just want to make my code short , and not wish to crea

[go-nuts] How can I compare the interface in a generic function

2017-01-05 Thread hui zhang
How can I compare the interface ? I want to implement a generic function. the <=>= report error in this code func InRange(a, b, c interface{}) bool { if c >= a && c <= b { return true } else { return false } } -- You received this message because you are subscribed to t

[go-nuts] how go cast multi return value type

2017-01-05 Thread fastfading
check code below func foo() (int32,int32) { . } var a,b int16 a, b = (int16, int16)foo() I want to cast multi return value , but it seems impossible in go, how can I do that I just want to make my code short , and not wish to create useless temp variable -- You received this message be

[go-nuts] Proposal for a succinct error return syntax

2017-01-05 Thread xjru
Here are some examples for valid error returns according to my proposal: file, err := os.Open(fname) ||| return err file, err := os.Open(fname) ||| panic(err) file, err := os.Open(fname) ||| return errors.Wrap(err, "too bad") The third example uses the Wrap function from github.com/pkg/errors

[go-nuts] Re: Facing linker issues while cross-compiling from Ubuntu/amd64 to darwin/amd64

2017-01-05 Thread Koichi Shiraishi (zchee)
Hi, Kedar. Is o64-clang is probably osxcross? If so, it seems to the same situation on my zchee/docker-machine-driver-xhyve projects CircleCI build testing. yml is here. circle.yml

[go-nuts] Re: Accessing an slice is too slow than Array

2017-01-05 Thread Dave Cheney
and at the end of the day, the difference per access is 1ns, 3-4 instructions on a modern Intel processor. On Friday, 6 January 2017 11:21:32 UTC+11, Keith Randall wrote: > > You're not really testing what you think you are testing. > > When you do "_ = load something", the compiler just throws a

[go-nuts] Re: Accessing an slice is too slow than Array

2017-01-05 Thread 'Keith Randall' via golang-nuts
You're not really testing what you think you are testing. When you do "_ = load something", the compiler just throws away the load. You have to use the result somehow to keep the load in the final assembly. What you are actually timing is the speed of the modulo operator (%). For the pointer c

[go-nuts] Re: [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-05 Thread Jacob Howard
Syncthing's transfer model is a bit different with it's block-exchange protocol, so it's a bit difficult to compare the exact behavior. For most use cases, I think you'd see comparable performance in terms of data transfer required for change propagation, though Mutagen could perform a few add

Re: [go-nuts] [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-05 Thread Jacob Howard
Thanks for the questions! Syncthing is, as you say, aimed at being a Dropbox replacement. It is designed to be set up for long-term synchronization sessions. Mutagen was designed for more ephemeral syncing, particularly for remote code editing. Its ancestry really lies closer to something li

Re: [go-nuts] fmt verb to single quote text

2017-01-05 Thread bsr
Andrew.. thank you so much. that works great.. On Thursday, January 5, 2017 at 3:37:51 PM UTC-5, Diddymus wrote: > > Maybe https://play.golang.org/p/9EewyQhD3U ? > > On Thursday, 5 January 2017 17:06:07 UTC, bsr wrote: >> >> Alexander. thank you very much for helping out. >> your program does out

Re: [go-nuts] Multiplexing blocking call on Go routine

2017-01-05 Thread zohaibsh
I think there a confusion of what I am trying to say. With the go routine approach there is cost of 1M connections + cost of 1M go routines running a blocking call all the time. With an event based system where I can multiplex code execution over a fixed size go routines, the cost is already cu

[go-nuts] Re: ServeMux: support for PATH_INFO and arguments

2017-01-05 Thread Manlio Perillo
Il giorno giovedì 5 gennaio 2017 21:58:18 UTC+1, v.pu...@gmail.com ha scritto: > > You can try: > https://github.com/pressly/chi These routers all have the same problems: * Non standard coding style (some seems to not use go fmt) * Registering a GET handler does not also register an HEAD handl

[go-nuts] ServeMux: support for PATH_INFO and arguments

2017-01-05 Thread v . pupillo
You can try: https://github.com/pressly/chi -- 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 http

Re: [go-nuts] Unmarshal mixed XML content

2017-01-05 Thread Shawn Milochik
On Thu, Jan 5, 2017 at 2:40 PM, John Leidegren wrote: > See https://play.golang.org/p/XjKdm7Pooh > > I was hoping to get back a, b followed by c but I get a, c then b. I just > can't get this to work. > > How is it even possible for it to read character data from before and > after the B node? >

Re: [go-nuts] fmt verb to single quote text

2017-01-05 Thread Diddymus
Maybe https://play.golang.org/p/9EewyQhD3U ? On Thursday, 5 January 2017 17:06:07 UTC, bsr wrote: > > Alexander. thank you very much for helping out. > your program does output my desired string, but value is read from parsing > struct comment and not sure how to get the same effect of multi lin

[go-nuts] ServeMux: support for PATH_INFO and arguments

2017-01-05 Thread Manlio Perillo
I'm using Go for a web application and currently I'm using the standard ServeMux since I don't need fancy features. The only features I need are PATH_INFO, and routing args. Unfortunately I have searched a few external packages but they all have some problems. * https://github.com/julienschmidt

[go-nuts] Unmarshal mixed XML content

2017-01-05 Thread John Leidegren
See https://play.golang.org/p/XjKdm7Pooh I was hoping to get back a, b followed by c but I get a, c then b. I just can't get this to work. How is it even possible for it to read character data from before and after the B node? -- You received this message because you are subscribed to the Goo

[go-nuts] Typed encoding

2017-01-05 Thread Daniel Martí
Hello all, I wrote a package that parses a language (bash) and constructs an AST. I would like to make it easier for other tools to use it, even outside of Go. I'm aware that Go can be built as a shared library, but I'd like to go a simpler route especially for scripting languages. What encoding

[go-nuts] Issue #5932 (net: do not wait on EAGAIN from lossy packet conn)

2017-01-05 Thread anner
Hi, I'd like to respond to #5932 , but can't because it is locked. Earlier we had issues (see comment 17), however it seems to be fixed in 1.7.4 and also a couple of versions ago (1.5, 1.6). The tested kernel version is: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.73-2

Re: [go-nuts] explain CLA terms

2017-01-05 Thread Ian Lance Taylor
On Wed, Jan 4, 2017 at 10:58 PM, Xavier Combelle wrote: > Le 05/01/2017 à 07:01, Ian Lance Taylor a écrit : > >> On Wed, Jan 4, 2017 at 8:21 PM, Xavier Combelle >> wrote: >>> I was interested in contributing in golang, but was afraid to contribute >>> because of signing the CLA. After rereading i

[go-nuts] Re: [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-05 Thread wilk
On 05-01-2017, Shawn Milochik wrote: > --94eb2c1a09e43b9d8205455b0873 > Content-Type: text/plain; charset=UTF-8 > > I really like the idea of what you have here. I'm currently using SyncThing > for this purpose. SyncThing seems to fit all your requirements with the > exception of only needing to be

Re: [go-nuts] fmt verb to single quote text

2017-01-05 Thread bsr
Alexander. thank you very much for helping out. your program does output my desired string, but value is read from parsing struct comment and not sure how to get the same effect of multi line string `hello ... \n world` In other word, my input is "hello ... \n world" and not sure how to convert

Re: [go-nuts] fmt verb to single quote text

2017-01-05 Thread Matthew Singletary
If you are using it in a fmt string (like your example), you can use the '%q' formatting verb (like this example ). On Thu, Jan 5, 2017 at 11:45 AM bsr wrote: Please see the example https://play.golang.org/p/SeG7oO5Us0 I am doing some javascript codegen a

Re: [go-nuts] fmt verb to single quote text

2017-01-05 Thread Alexander Kapshuk
On Thu, Jan 5, 2017 at 6:45 PM, bsr wrote: > Please see the example https://play.golang.org/p/SeG7oO5Us0 > > I am doing some javascript codegen and I want my values single quoted. so, > in the above example, I want the output to be > > > { v: 'hello ... \n world'} > > > instead of > > { v: '"hello

[go-nuts] fmt verb to single quote text

2017-01-05 Thread bsr
Please see the example https://play.golang.org/p/SeG7oO5Us0 I am doing some javascript codegen and I want my values single quoted. so, in the above example, I want the output to be { v: 'hello ... \n world'} instead of { v: '"hello ... \n world"'} or { v: "hello ... \n world"} how can I do

Re: [go-nuts] [JOB] Intermediate/Senior Developer at OneConfig

2017-01-05 Thread Charl Matthee
Unfortunately not. On Thu, 05 Jan 2017 at 17:18 Nyah Check wrote: > Can you work remotely? > > > On Jan 3, 2017 1:20 PM, "Charl Matthee" wrote: > > Hi, > > OneConfig is in the process of growing our technical team and looking for > some intermediate/senior Go developers in Cape Town, South Afr

Re: [go-nuts] Re: golang-beginners channel?

2017-01-05 Thread Marcus Franke
Hi, You should join the gophers slack. There is a golang-newbies channel. pacninja schrieb am Do., 5. Jan. 2017, 16:28: > I'm in if someone starts the channel. > > > On Thursday, January 5, 2017 at 11:44:16 AM UTC+5:30, Jason E. Aten wrote: > > I noticed that rust has a rust-beginners irc cha

Re: [go-nuts] [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-05 Thread Shawn Milochik
I really like the idea of what you have here. I'm currently using SyncThing for this purpose. SyncThing seems to fit all your requirements with the exception of only needing to be installed on one of the machines. However, in return SyncThing allows you to select which folders are shared from each

Re: [go-nuts] Facing linker issues while cross-compiling from Ubuntu/amd64 to darwin/amd64

2017-01-05 Thread Ian Lance Taylor
On Thu, Jan 5, 2017 at 5:42 AM, Kedar Babar wrote: > > I had written a small go program, which refers the 'C' code, following > is the snippet > > package main > > /* > #include > */ > import "C" > import "fmt" > > const cgoAddrInfoFlags = (C.AI_CANONNAME | C.AI_V4MAPPED | C.AI_ALL) & > C.AI_

[go-nuts] Facing linker issues while cross-compiling from Ubuntu/amd64 to darwin/amd64

2017-01-05 Thread Kedar Babar
Hi, I had written a small go program, which refers the 'C' code, following is the snippet package main /* #include */ import "C" import "fmt" const cgoAddrInfoFlags = (C.AI_CANONNAME | C.AI_V4MAPPED | C.AI_ALL) & C.AI_MASK func main() { fmt.Println("Hello") } When i build the above

[go-nuts] Re: golang-beginners channel?

2017-01-05 Thread pacninja
I'm in if someone starts the channel. On Thursday, January 5, 2017 at 11:44:16 AM UTC+5:30, Jason E. Aten wrote: > > I noticed that rust has a rust-beginners irc channel. That seems like a > very welcoming idea. > > ~~~ > > The most important community resources for those new to Rust are: > >

[go-nuts] [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-05 Thread Jacob Howard
Greetings fellow Gophers! I wanted to share and get feedback on a Go project that I've been working on for a little while called Mutagen: Usage information: https://havoc-io.github.io/mutagen/ Source: https://github.com/havoc-io/mutagen It's a continuous, bidirectional file synchronization util

Re: [go-nuts] [JOB] Intermediate/Senior Developer at OneConfig

2017-01-05 Thread Nyah Check
Can you work remotely? On Jan 3, 2017 1:20 PM, "Charl Matthee" wrote: > Hi, > > OneConfig is in the process of growing our technical team and looking for > some intermediate/senior Go developers in Cape Town, South Africa. > > *About Us* > > At OneConfig we simplify the complicated and expensive

[go-nuts] code gen off a golang template --> a data binding struct ?? Anyone found a library that can do this..

2017-01-05 Thread Joe Blue
Hey all !! I have been googling for this, and wondering if i should try and write something to specifically do this. Here is the idea... There are lots of awesome libraries out there to help me code gen from a struct to lots of other things. But i need the ability to code gen from a standard g

[go-nuts] Re: Accessing an slice is too slow than Array

2017-01-05 Thread Uli Kunitz
A few comments: For such microbenchmarks you need to check the assembler for optimizations. The C code probably removed the complete loop. The Go version and machine architecture is relevant. There were significant changes recently, particular with the introduction of SSA (static single assign

[go-nuts] Re: How to pass a go file name as arguments to go run

2017-01-05 Thread bsr
thanks Dave. This is to test a code generation utility during development, so not to build/install etc, but run directly. thanks again for your help. On Thursday, January 5, 2017 at 12:07:55 AM UTC-5, Dave Cheney wrote: > > go run cmd/main.go -- tests/a/in.go > > But you've probably reached the

Re: [go-nuts] Re: How to use ~/ in terminal with go program?

2017-01-05 Thread Aurélien DESBRIÈRES
Thanks a lot! On Thu, Jan 5, 2017 at 11:32 AM Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > On Thu, 5 Jan 2017 02:09:24 -0800 (PST) > Aurélien Desbrières wrote: > > > Vendor?? you mean I have to pay to write software? I have to pay to > > use a lib? > > I suppose you were actua

Re: [go-nuts] Re: How to use ~/ in terminal with go program?

2017-01-05 Thread Konstantin Khomoutov
On Thu, 5 Jan 2017 02:09:24 -0800 (PST) Aurélien Desbrières wrote: > Vendor?? you mean I have to pay to write software? I have to pay to > use a lib? I suppose you were actually trying to reply to this remark by Ian Davis: > Vendor the library using Go's vendoring support. Then you will always

Re: [go-nuts] Re: How to use ~/ in terminal with go program?

2017-01-05 Thread Aurélien Desbrières
Vendor?? you mean I have to pay to write software? I have to pay to use a lib? On Thursday, January 5, 2017 at 8:19:21 AM UTC+1, Konstantin Khomoutov wrote: > > On Tue, 3 Jan 2017 00:00:27 -0800 (PST) > Caleb Doxsey > wrote: > > > What's wrong with a library? > > > > This particular library

Re: [go-nuts] Google Grumpy (Python->Go)

2017-01-05 Thread Justin Israel
I just gave this a play since I was really curious what it could do. But it seems like of your python module has imports for other python modules, they get transpiled into Go import statements that look at the grumpy stdlib location. Does anyone have any information on the extend of the support, be

[go-nuts] Accessing an slice is too slow than Array

2017-01-05 Thread P Q
I measured how long it takes to access an element on array in three ways: array, slice, unsafe.Pointer https://play.golang.org/p/Ofz3u8_AZe BenchmarkArray : 500025.7 ns/op BenchmarkSlice : 200059.1 ns/op BenchmarkPointer: 3 6.85 ns/op BenchmarkC : 2