[go-nuts] Re: Bulky (Payload) Structs in API

2017-11-13 Thread dc0d
Thanks! The bot package was just an example. This is a general concern IMHO. Interfaces do nicely when we want to hide implementation details (on accepting things as an interface). For example package A is a low-level, infrastructure package at Infrastructure layer/area. Now at the Interfaces

[go-nuts] Re: Bulky (Payload) Structs in API

2017-11-13 Thread Egon
Is there a problem created from sharing the package or creating a separate package? Or why is that dependency a problem? There's some knowledge about the requests/responses shared between packages. Trying to hide it, doesn't gain anything -- it only makes the sharing implicit rather than

[go-nuts] pprof implementation concepts

2017-11-13 Thread dmitri
I've put together a blog post explaining the implementation concepts behind CPU, allocation and block profilers. It is not as detailed as some of the original articles, but hopefully useful to pprof users in terms of better understanding what to expect from the data.

[go-nuts] Re: fetching URLs Concurrently

2017-11-13 Thread Nilsocket
Could you edit your question, it's unclear and format your code. -- 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

[go-nuts] driver.Rows -> sql.Rows

2017-11-13 Thread Tamás Gulácsi
This has already been asked at golang-sql (https://groups.google.com/forum/#!topic/golang-sql/HNvcgScdyt8), but no answer yet. Maybe the wider audience here has a solution. Hi, Is there a way to convert a driver.Rows to an sql.Rows ? Oracle is a strange, inconsistent beast where you can return

[go-nuts] Understanding panic at addr=0x38 when calling a method on a nil interface

2017-11-13 Thread Konstantin Khomoutov
While debugging a program which had a panic due to an attempt to call a method on a value of an interface typeš, I came across the behaviour I find strange, and would like to get help understanding what happens. The behaviour is exhibited by this simple program:

[go-nuts] Re: fetching URLs Concurrently

2017-11-13 Thread Nilsocket
package main import ( "fmt" "io" "io/ioutil" "net/http" "os" "sync" "time" ) var wg sync.WaitGroup func main() { start := time.Now() ch := make(chan string) for _, url := range os.Args[1:] { wg.Add(1) go fetch(url, ch) } for range

Re: [go-nuts] Re: OpenCL or CUDA bindings

2017-11-13 Thread Christian LeMoussel
For CUDA you have, cu package that provides an idiomatic interface to the CUDA Driver API. https://github.com/chewxy/cu -- 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

[go-nuts] fetching URLs Concurrently

2017-11-13 Thread 2891132love
I try writing the program and run it. the program is as following: package main import ( "fmt" "io" "io/ioutil" "net/http" "os" "time" ) func main() { start := time.Now() ch := make(chan string) for _, url := range os.Args[1:] { go fetch(url, ch)

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread 'Bryan Mills' via golang-nuts
In this case, the "code golf" solution seems clearer: https://play.golang.org/p/Jxkf2Vheml On Monday, November 13, 2017 at 3:57:57 PM UTC-8, peterGo wrote: > > Christian, > > Your specialized convertCharToInt32 function, which returns []uint32, is > slow in comparison to a more general

[go-nuts] Re: Will a running GC task stop immediately once debug.SetGCPercent(-1) is called?

2017-11-13 Thread keith . randall
The runtime will still finish any in-progress garbage collection. debug.SetGCPercent only affects the trigger point (when to start) and the pacing (at what rate to mark the heap). On Monday, November 13, 2017 at 2:40:29 PM UTC-8, T L wrote: > > or runtime will still try to finish the current

Re: [go-nuts] Understanding panic at addr=0x38 when calling a method on a nil interface

2017-11-13 Thread keith . randall
Konstantin, your description is correct. The code is trying to load a function pointer out of an itab, but the pointer to the itab is nil. I think this is actually a bug. If you have an interface with more than pagesize/ptrsize methods in it, this code might not panic when it should. On

[go-nuts] Re: Who are the https://gophers.slack.com/ admins?

2017-11-13 Thread Jon Calhoun
I believe the people over at https://golangbridge.org/ are responsible for the Slack as well, so I would contact them. On Monday, November 13, 2017 at 1:41:13 PM UTC-5, Vlad Didenko wrote: > > My phone got stolen, so I am locked out of the https://gophers.slack.com/ > 2FA. > > Slack tells to

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread peterGo
Bryan, Use the test case from the question: buffer := "83f982d600c1caca7a6". https://play.golang.org/p/1gN7Y4ajOH Peter On Monday, November 13, 2017 at 7:42:16 PM UTC-5, Bryan Mills wrote: > > In this case, the "code golf" solution seems clearer: > https://play.golang.org/p/Jxkf2Vheml > > On

Re: [go-nuts] Understanding panic at addr=0x38 when calling a method on a nil interface

2017-11-13 Thread keith . randall
Filed issue https://github.com/golang/go/issues/22703 On Monday, November 13, 2017 at 3:50:58 PM UTC-8, Keith Randall wrote: > > Konstantin, your description is correct. The code is trying to load a > function pointer out of an itab, but the pointer to the itab is nil. > I think this is

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread peterGo
Christian, Your specialized convertCharToInt32 function, which returns []uint32, is slow in comparison to a more general HexToUint function. BenchmarkHexToUint32-8 200088.9 ns/op 16 B/op2 allocs/op BenchmarkCharToInt32-8300 438 ns/op 96 B/op 22 allocs/op

[go-nuts] Re: Golang crashes windows console

2017-11-13 Thread Sotirios Mantziaris
hi, i had the same issue. My fix was to upgrade or downgrade git. The latest git version 2.15.0.windows.1 works ok. On Monday, November 13, 2017 at 5:33:55 PM UTC+2, Patrick Hadlaw wrote: > > I've posted my problem on stack overflow and could not fix it! > >

[go-nuts] Golang crashes windows console

2017-11-13 Thread Dave Cheney
This has been reported previously and appears to be a bug in git which causes come.exe. Sorry I don’t have the details, how his could be possible escapes me, but I’ve long since given up being surprised by the bizarre layer violations in windows. -- You received this message because you are

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread 'Bryan Mills' via golang-nuts
Yes, it looked like a typo to me. Truncating the string to an even number of characters gives the same results as the original snippet: https://play.golang.org/p/avf6xqnpEn It's also not difficult to pad the input, if that's the desired behavior: https://play.golang.org/p/Q6C9SBhQB5 (Padding

Re: [go-nuts] Understanding panic at addr=0x38 when calling a method on a nil interface

2017-11-13 Thread Alexander Kapshuk
On Mon, Nov 13, 2017 at 1:42 PM, Konstantin Khomoutov wrote: > While debugging a program which had a panic due to an attempt to call a > method on a value of an interface typeš, I came across the behaviour I > find strange, and would like to get help understanding what happens.

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread Dmitry Savintsev
Hi Christian, just a form note - it would be preferable and easier for the readers to put a code snippet into https://play.golang.org and share the link, similar to this one: https://play.golang.org/p/p3TNDze923 It also helps to make sure that program is syntactically correct (not clear in

Re: [go-nuts] fetching URLs Concurrently

2017-11-13 Thread Ayan George
On 11/13/2017 04:10 AM, 2891132l...@gmail.com wrote: > for range os.Args[1:] { >   fmt.Println(<-ch) >      } >      fmt.Printf("%.2fs elasped\n", time.Since(start).Seconds()) > } If I understand correctly, you want fetch() to get each URL twice but you only read from the 'ch'

Re: [go-nuts] Why doesn't sync.Cond embed sync.Locker?

2017-11-13 Thread 'Thomas Bushnell, BSG' via golang-nuts
Sometimes you want multiple Conds which share the same Locker. When you want it, it's frequently essential and very annoying if you can't have it. On Sun, Nov 12, 2017 at 7:02 PM T L wrote: > . > > -- > You received this message because you are subscribed to the Google

[go-nuts] Re: How to convert from []byte to []uint32?

2017-11-13 Thread howardcshaw
The hack would be to use unsafe after converting it to a byte slice to cast to a Pointer and cast that back to a uint32 slice. This is bad. Do not do this. Go's ethos is pretty strongly against 'super cool hacks' or 'code golf' style statements that perform magic to stuff a lot of code into

[go-nuts] Re: Simple exec.Command() program

2017-11-13 Thread bucarr
> > You guys are great. Not only did you explain at length, what I was > misunderstanding, but you offered several solutions. > Thanks to one and all! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: [code review] Exercise documenting a Go project

2017-11-13 Thread Vlad Didenko
Concrete questions after the question feedback at Stack Exchange: Specific features used as user-facing conveniences are: - Provided the license in a standard location - Most useful API functions highlighted in the front-page README - All Exported functions documented via GoDoc, made sure it

[go-nuts] Support for vsan mgmt APIs in govmomi

2017-11-13 Thread nkhan
Is there support for vsan mgmt APIs in govmomi similar to pyvmomi? What I am specifically looking for is to be able to query vsan cluster health summary -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] [code review] Exercise documenting a Go project

2017-11-13 Thread Vlad Didenko
*fst* is the package I posted to practice community-related workflows, including writing documentation, using *travis-ci*, setting up vanity URL redirection. The *fst* package adds convenience routines for testing filesystem-related logic, helps to create, clone, cleanup, and compare

[go-nuts] Who are the https://gophers.slack.com/ admins?

2017-11-13 Thread Vlad Didenko
My phone got stolen, so I am locked out of the https://gophers.slack.com/ 2FA. Slack tells to ask project admins to temporarily reset @FA on the account, but I found no way to find who are the admins for the gophers workspace. Anyone knows?

Re: [go-nuts] How can interfaces be comparable and at the same time functions not?

2017-11-13 Thread 'Axel Wagner' via golang-nuts
Oh, and FWIW: On Mon, Nov 13, 2017 at 12:45 PM, 'Stephan Schweitzer' via golang-nuts < golang-nuts@googlegroups.com> wrote: > It seems to me, that I can break the type system with simple assignments. > For that definition of "breaking the type system", you don't even need assignments: func

Re: [go-nuts] How can interfaces be comparable and at the same time functions not?

2017-11-13 Thread 'Axel Wagner' via golang-nuts
On Mon, Nov 13, 2017 at 12:45 PM, 'Stephan Schweitzer' via golang-nuts < golang-nuts@googlegroups.com> wrote: > >- Why are interfaces comparable by default? > > A very common comparison on interfaces is "if err == io.EOF". It also enables you, in general, to use interfaces as map keys (or,

[go-nuts] Golang crashes windows console

2017-11-13 Thread Patrick Hadlaw
I've posted my problem on stack overflow and could not fix it! https://stackoverflow.com/questions/46392778/golang-crashing-windows-console I'm running Windows 10, installed go through x64 msi installer. Basically, whenever I run Go in cmd with an argument (build, env, list, get...) the program

[go-nuts] net/http: Server closeIdleConns does not close StateNew connections

2017-11-13 Thread Kevin Burge
I recently ran into an issue where Chrome was opening additional connections to my http Server. When I went close to the Go app, instead of just immediately closing after calling server.Shutdown, in lingered until the server was forcefully shutdown by my shutdown context. The issue is that

[go-nuts] How can interfaces be comparable and at the same time functions not?

2017-11-13 Thread 'Stephan Schweitzer' via golang-nuts
I have a question about the following code-snippet: type I interface { DoSomething() } type F func() func (f F) DoSomething() { f() } func A() { fmt.Println("A") } func B() { fmt.Println("B") } func test() {

[go-nuts] Re: How can interfaces be comparable and at the same time functions not?

2017-11-13 Thread T L
On Monday, November 13, 2017 at 10:33:55 AM UTC-5, Stephan Schweitzer wrote: > > I have a question about the following code-snippet: > > type I interface { > DoSomething() > } > > type F func() > > func (f F) DoSomething() { > f() > } > > func A()

Re: [go-nuts] net/http: Server closeIdleConns does not close StateNew connections

2017-11-13 Thread André Carvalho
I also ran into this issue recently. I think this is a dup of https://github.com/golang/go/issues/21204. This issue can be mitigated if you set some reasonable ReadTimeout on the http.Server, which causes the http.StateNew connection to timeout (a connection stays in this state until something is

Re: [go-nuts] Re: network programming about go

2017-11-13 Thread Justin Israel
On Mon, Nov 13, 2017 at 4:00 PM <2891132l...@gmail.com> wrote: > I know your meaning.But I still can't get the result I want. > this is the server program: > package main > > import ( > "fmt" > "net" > "os" > "strings" > ) > > func main() { > > listener, err := net.Listen("tcp", "0.0.0.0:400") >

Re: [go-nuts] Why doesn't sync.Cond embed sync.Locker?

2017-11-13 Thread T L
On Monday, November 13, 2017 at 10:10:22 AM UTC-5, Thomas Bushnell, BSG wrote: > > Sometimes you want multiple Conds which share the same Locker. When you > want it, it's frequently essential and very annoying if you can't have it. > Embedding doesn't prevent this. I ask this question is for

[go-nuts] Will a running GC task stop immediately once debug.SetGCPercent(-1) is called?

2017-11-13 Thread T L
or runtime will still try to finish the current running task? -- 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