Re: [go-nuts] Problems with regexp

2017-08-29 Thread Marcus Franke
On Mon, Aug 28, 2017 at 07:37:52PM -0700, Hugh S. Myers wrote: > (.*) is greedy… try ([^\[]+) this should consume all till it runs into the > open bracket, your next group… There is this nice webpage https://regex101.com It supports golang as regex flavor, and does a great job at explaining the c

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread Tong Sun
Oh, I'm sorry, I first noticed it from golang playground, then noticed the same behavior locally. But I forgot that my Emacs code formatting ties *not only* gofmt but also with `goimports`, where the problem really occurs. Sorry about making the fuzz. I'll recomiple goimports as well... On Wed,

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread andrey mirtchovski
> Have you tried with gofmt 1.9 locally before posting? of course. that is what i showed in the original post: $ go version go version go1.9 darwin/amd64 $ gofmt t.go package main import ( "fmt" ) type myint = int func main() { var ii myint = 5 fmt.Println("Hello, playground#", ii)

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread Caleb Spare
Works for me locally. I use both gofmt and goimports; for the latter, I had to recompile it. https://github.com/golang/go/issues/21645 is about updating the playground. On Tue, Aug 29, 2017 at 9:05 PM, Tong Sun wrote: > > > On Wednesday, August 30, 2017 at 12:02:28 AM UTC-4, andrey mirtchovski

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread Tong Sun
On Wednesday, August 30, 2017 at 12:02:28 AM UTC-4, andrey mirtchovski wrote: > > occam's razor: most likely the playground is running an old gofmt. > Have you tried with gofmt 1.9 locally before posting? I have. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread andrey mirtchovski
occam's razor: most likely the playground is running an old gofmt. $ gofmt t.go package main import ( "fmt" ) type myint = int func main() { var ii myint = 5 fmt.Println("Hello, playground#", ii) } $ ~/go1.4/bin/gofmt t.go t.go:7:12: expected type, found '=' ... On Tue, Aug 29, 201

[go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread Tong Sun
Go 1.9 introduced type alias but the `gofmt` that comes with go 1.9 can't handle type alias. Demo here: https://play.golang.org/p/ldzfOJfj7V 7:11: expected type, found '=' (and 1 more errors) but it runs fine. -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] Unexpected cgo argument has Go pointer to Go pointer

2017-08-29 Thread brainman
On Wednesday, 30 August 2017 03:54:10 UTC+10, Phil Noel wrote: > By using syscall.NewLazyDLL and dynamically loading the function, then > with the loaded function just use func.Call(). > Yes, that is what everyone is doing, including Go standard library. You can also use syscall.Syscall, sysc

Re: [go-nuts] CGO build error in 1.9

2017-08-29 Thread Ian Lance Taylor
On Tue, Aug 29, 2017 at 3:04 PM, Adrian Sampaleanu wrote: > Hmm, yeah - they're rand() and srand(), respectively. Would've thought these > are standard names. rand and srand are the names defined in the C89 ANSI standard. random and srandom were defined by POSIX.1-2001, based on earlier BSD func

Re: [go-nuts] CGO build error in 1.9

2017-08-29 Thread Adrian Sampaleanu
Hmm, yeah - they're rand() and srand(), respectively. Would've thought these are standard names. On Tuesday, August 29, 2017 at 5:58:17 PM UTC-4, Ian Lance Taylor wrote: > > Is it possible that on the version of GCC you are using with MinGW > that does not declare random and srandom? > > Ian

Re: [go-nuts] Add factory argument to built-in make() function?

2017-08-29 Thread 'Axel Wagner' via golang-nuts
Okay, so, my assumptions where more or less spot on, then :) It seems, you are mostly aware of the complexities of your proposal. But let me go a little deeper. If you are able to use a custom implementation as a map[A]B, then any *user* of map[A]B would need to know how to access the elements of

Re: [go-nuts] CGO build error in 1.9

2017-08-29 Thread Ian Lance Taylor
On Tue, Aug 29, 2017 at 2:24 PM, Adrian Sampaleanu wrote: > > I'm on Windows 10, 64 bit, with MinGW's gcc 7.2.0. The code I pasted isn't > relevant - I just pasted the first example from the Go blog, on cgo, as a > sanity check. I've now checked the "stdio" cgo sample that ships with the Go > dist

Re: [go-nuts] CGO build error in 1.9

2017-08-29 Thread Ian Lance Taylor
On Tue, Aug 29, 2017 at 1:24 PM, Adrian Sampaleanu wrote: > > When running "go build" on the following code: > > package main > > // #include > import "C" > > func Random() int { >return int(C.random()) > } > > func Seed(i int) { >C.srandom(C.uint(i)) > } > > func main() { > } > > > I get

[go-nuts] Upload File Size Limit in Go 1.9

2017-08-29 Thread Andrew
Go 1.9 has "The new FileHeader.Size field describes the size of a file in a multipart message." Suppose I upload multiple files using Can I use FileHeader.Size to limit *each* uploaded file size? Or there's other ways? Thanks, Andrew

Re: [go-nuts] Add factory argument to built-in make() function?

2017-08-29 Thread RogerV
make() lets me specify a key and element type for a map collection but there's only one implementation of map. What about expanding on make() to where custom implementations of map can be specified instead? make() would accept a new argument that would let me indicate a factory mechanism to use

Re: [go-nuts] Re: gomobile socket permissions

2017-08-29 Thread Dan Ballard
Hey thanks! I got it to work! On Wed, Aug 16, 2017 at 8:41 AM Elias Naur wrote: > Hi, > > Have you tried the golang.org/x/mobile/example/network example? It's a > "pure" Go app that doesn't use Java bindings, but its network access > properties should be the same. > > If that works, you could mo

Re: [go-nuts] Unexpected cgo argument has Go pointer to Go pointer

2017-08-29 Thread Phil Noel
As a FYI for anyone else who may have this problem. After doing some more reading/searching another solution is to not use cgo at all. By using syscall.NewLazyDLL and dynamically loading the function, then with the loaded function just use func.Call(). This completely skips cgo and thus all t

Re: [go-nuts] Unexpected cgo argument has Go pointer to Go pointer

2017-08-29 Thread Phil Noel
On Tuesday, 29 August 2017 18:21:58 UTC+1, Ian Lance Taylor wrote: > > On Tue, Aug 29, 2017 at 8:53 AM, Phil Noel > wrote: > > > > I believe the error is that _cgoCheckPointer is scanning the _cgo0 > variable > > (ie c_msg, ie type *_Ctype_struct_tagMSG) and detecting the > > hwnd:(win._Cty

Re: [go-nuts] Re: Loading assets with gomobile bind in a webview app

2017-08-29 Thread Lantos István
I know I only use it load the one template file, this is why I don't use partials or a main layout. Able to reference external CSS, JS files would be quite useful. Is there any way to solve this? This seems like a very important feature which not yet implemented into gomobile. Here is a test file

[go-nuts] Re: can list.List.Push* or Get return nil?

2017-08-29 Thread Egon
Is there a reason you are using `container/list`, in most cases it's the wrong solution. Slices in most cases are faster and use less resources and easier to work with. + Egon On Tuesday, 29 August 2017 01:50:10 UTC+3, BeaT Adrian wrote: > > Hello, I just started to learn golang and I have a sm

[go-nuts] Re: Loading assets with gomobile bind in a webview app

2017-08-29 Thread Egon
AFAIR asset.Open doesn't support folders. On Tuesday, 29 August 2017 20:06:34 UTC+3, Lantos István wrote: > > I created a gomobile app with the bind command. The `Main.java` app > embedding the go webserver into webview. > > I placed my css file in `./src/main/assets/css/main.css` location. I >

Re: [go-nuts] Unexpected cgo argument has Go pointer to Go pointer

2017-08-29 Thread Ian Lance Taylor
On Tue, Aug 29, 2017 at 8:53 AM, Phil Noel wrote: > > I believe the error is that _cgoCheckPointer is scanning the _cgo0 variable > (ie c_msg, ie type *_Ctype_struct_tagMSG) and detecting the > hwnd:(win._Ctype_HWND)(0x5a0cdc) value 0x5a0cdc is a pointer to something on > the Go heap. > > In reali

[go-nuts] Loading assets with gomobile bind in a webview app

2017-08-29 Thread Lantos István
I created a gomobile app with the bind command. The `Main.java` app embedding the go webserver into webview. I placed my css file in `./src/main/assets/css/main.css` location. I referencing in the template file with: But it's not showing up. The background should be red. I discovered `asset.

Re: [go-nuts] what is 'string'

2017-08-29 Thread Shawn Milochik
A string is a built-in part of Go: https://golang.org/pkg/builtin/#string If a type implements a String() method it fulfills the Stringer interface: https://golang.org/pkg/fmt/#Stringer -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscr

[go-nuts] what is 'string'

2017-08-29 Thread V Cekvenich
In here: func (p pair) String() string { from https://learnxinyminutes.com/docs/go/ What is string? -- 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-nut

[go-nuts] Unexpected cgo argument has Go pointer to Go pointer

2017-08-29 Thread Phil Noel
Hello, I've been coding up a Windows based application and hit a problem that I sort of understand however not how to resolve. The debug + panic is TranslateMessage Msg: &win.Msg{Wnd:(win.HWnd)(0x5a0cdc), Message:0x113, WParam:0x1, LParam:0, Time:0x28699637, Pt:win.Point{X:1174, Y:488}} Transl

Re: [go-nuts] Monitoring activity stdin / stdout

2017-08-29 Thread Shawn Milochik
Perhaps you can use a TeeReader, and reset a timer each time there's activity. https://golang.org/pkg/io/#TeeReader -- 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

[go-nuts] Re: can list.List.Push* or Get return nil?

2017-08-29 Thread BeaT Adrian
Thanks, my bad, for Back() and Front() is obvious, returns nil when there are no elements left. But I don't see how a Push*() can return nil, it always return an Element. If I push a nil it will return an Element with value=nil. On Tuesday, August 29, 2017 at 7:27:31 AM UTC+3, snmed wrote: > >

[go-nuts] Monitoring activity stdin / stdout

2017-08-29 Thread Rich
I am trying to think of a way to monitor stdin... I have this small program that spawns a bash shell. What I am looking for is to detect inactivity package main import ( "os/exec" "os" ) func main() { shellCmd := exec.Command("/bin/bash", "-l") //shellCmd := exec.Command(mysqlBi

[go-nuts] Re: Correct checkout branch go1.9 in 'Installing Go from source'

2017-08-29 Thread peterGo
Will Zhou, Yes. The objective is to be on the current point release. For example. // Clone current point release: go1.9.1 $ git clone https://go.googlesource.com/go $ cd go/src $ git checkout release-branch.go1.9 $ ./make.bash $ go version go version go1.9.1 linux/amd64 // ... // Update to cur

[go-nuts] Re: Correct checkout branch go1.9 in 'Installing Go from source'

2017-08-29 Thread Marvin Stenger
It's a tag. git tag -l will list it. Am Dienstag, 29. August 2017 14:55:24 UTC+2 schrieb Will Zhou: > > In the page Installing Go from source > , of the section below, branch > 'go1.9' should be changed to 'release-branch.go1.9'. > > > Fetch the repository

[go-nuts] Correct checkout branch go1.9 in 'Installing Go from source'

2017-08-29 Thread Will Zhou
In the page Installing Go from source , of the section below, branch 'go1.9' should be changed to 'release-branch.go1.9'. Fetch the repository Go will install to a directory named go. Change to the directory that will be its parent and make sure the godi

[go-nuts] ANN: objstore a multi-master distributed caching layer for Amazon S3

2017-08-29 Thread Maxim Kupriianov
Hi gophers, let me share a cool project with you. https://github.com/SphereSoftware/objstore This project aims to provide an easy to use, self-organising multi-master caching layer for various cloud stoarge backends, e.g. S3. It combines functionality of a simple object storage with added robustn

[go-nuts] Re: Convert grid of colors to SVG

2017-08-29 Thread ojucie
Steve, publish your code. Let the world know how YOU solve that particular problem. If you can contribute a functionality to a larger library, great, do it, but please don't hinder yourself by thinking "maybe someone have done something better". That is destructive thinking. If Ken, Rob and Ro

Re: [go-nuts] Any historical discussion around support "go generate -parallel n"?

2017-08-29 Thread Jan Mercl
go generate "scripts" may fail to work in parallel and people will ask why not, even though they shouldn't have used the -parallel option in those cases in the first place. But /go:generate go run mysafeparallelgen.go can be used today. On Tue, Aug 29, 2017, 07:14 Guanhua Jiang wrote:

Re: [go-nuts] ANN: xcryptossh: an ssh library with per channel timeouts and context based cancellation

2017-08-29 Thread Jason E. Aten
Hi Konstantin - thanks for your interest! I have not proposed merging it upstream. The x/crypto libraries are fairly slow to evolve, so for experimenting with a new API, an immediate merge is probably not wise. Since the API adds support for cancelation, it isn't backwards compatible. Merging it

Re: [go-nuts] Re: Convert grid of colors to SVG

2017-08-29 Thread Konstantin Khomoutov
On Mon, Aug 28, 2017 at 06:35:25AM -0700, ajstarks wrote: > it would be helpful to better understand what you want to do, but: > > https://speakerdeck.com/ajstarks/svgo-code-plus-picture-examples > > includes the code below (with many other examples would should be > illustrate the capabilities

Re: [go-nuts] ANN: xcryptossh: an ssh library with per channel timeouts and context based cancellation

2017-08-29 Thread Konstantin Khomoutov
On Sat, Aug 26, 2017 at 04:47:04PM -0700, Jason E. Aten wrote: > https://github.com/glycerine/xcryptossh > > This is an evolution of golang.org/x/crypto/ssh to fix memory leaks, > provide for graceful shutdown, and implement idle timeouts for each > multiplexed channel. It is not API backwards