[go-nuts] Re: go-gcnl: Golang library for accessing the Google Cloud Natural Language API

2016-12-14 Thread Josh Lubawy
Haha unfortunately I found these shortly after I already created the library :( Ironically I had searched (on Google) for such a library before I started, but it didn't show up (maybe because it's a part of the App Engine API and I was using AWS at the time). Of course I'd recommend using

[go-nuts] Boilerpipe port from Java to Go (extracts text content from HTML articles)

2016-12-14 Thread Josh Lubawy
Hi All, For those that are interested I've started a port of the popular Java library Boilerpipe in Go. - *(New) Golang port:* https://github.com/jlubawy/go-boilerpipe/ - *Original library:* https://github.com/kohlschutter/boilerpipe Give it a try using the 'boilerpipe' command line

[go-nuts] Re: How to report about app crash to the monitoring server?

2016-12-14 Thread Maksim Sitnikov
On Thursday, December 15, 2016 at 9:17:09 AM UTC+4, Miki Tebeka wrote: > > You can probably add a defer/recover to your main which will "catch" > panics, report the panic and stack trace and then exit your program with > non zero code. > This won't work. Because it's not possible to recover

Re: [go-nuts] gob ignores default values, bug or feature?

2016-12-14 Thread Nigel Tao
On Sat, Dec 10, 2016 at 11:14 PM, Matthew Zimmerman wrote: > Yes, it makes them smaller I agree, however shouldn't the lack of a value on > decoding be considered like a zero value was encoded? I think that is the > question here. It's pretty much academic at this point,

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread T L
On Thursday, December 15, 2016 at 10:18:57 AM UTC+8, T L wrote: > > But if I changed the line > type MyInt int32 > to > type MyInt int > then again, the memclr version becomes slower, or no advantage, for cases > of slice lengths larger than 200. > Tried other types, looks the situation

[go-nuts] Re: Advice for new type of net.Conn

2016-12-14 Thread mlayher via golang-nuts
This is a problem I've been thinking on for a while. As far as I can tell, the best way to go about it will be to somehow expose the runtime network poller. I've made a proposal to do so: https://github.com/golang/go/issues/15021. I'd love to make it happen, but I don't have the runtime chops

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread T L
But if I changed the line type MyInt int32 to type MyInt int then again, the memclr version becomes slower, or no advantage, for cases of slice lengths larger than 200. On Thursday, December 15, 2016 at 10:05:23 AM UTC+8, T L wrote: > > > > On Wednesday, December 14, 2016 at 10:12:08 PM

Re: [go-nuts] Debug memory leaks in cgo calls

2016-12-14 Thread Ian Lance Taylor
On Wed, Dec 14, 2016 at 4:57 PM, Pablo Rozas Larraondo wrote: > > I've seen this question asked before in the mail list but with no clear > answers. I'm just asking it again in case someone has come up with a new way > of doing this: > > Does anyone know about a good

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread sheepbao
I have the same result in the Mac, go 1.7.1 ```go BenchmarkMemclr_100-4 1 22.8 ns/op BenchmarkLoop_100-4 3000 47.1 ns/op BenchmarkMemclr_1000-4 1000 181 ns/op BenchmarkLoop_1000-4 500 365 ns/op BenchmarkMemclr_1-4

[go-nuts] Debug memory leaks in cgo calls

2016-12-14 Thread Pablo Rozas Larraondo
I've seen this question asked before in the mail list but with no clear answers. I'm just asking it again in case someone has come up with a new way of doing this: Does anyone know about a good tool or method to detect memory leaks happening on C code being called by cgo? Cheers, Pablo -- You

[go-nuts] Re: float32 vs float64 precision lost when casting to int

2016-12-14 Thread notcarl via golang-nuts
Is this just due to IEEE754 rounding mode? I think the spec says round to even. On Wednesday, December 14, 2016 at 9:36:23 AM UTC-8, Mauro Trajber wrote: > > The float to int conversion behaves different for 32 and 64 precision. > https://play.golang.org/p/-zkCNSTbNa > > Is this the correct

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread notcarl via golang-nuts
Be wary of slice size, as caching is going to have an extremely strong effect on the results. I submitted a CL that made append, only clear memory that was not going to be overwritten ( https://github.com/golang/go/commit/c1e267cc734135a66af8a1a5015e572cbb598d44 ). I thought this would have

Re: [go-nuts] Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread Bakul Shah
> On Dec 14, 2016, at 12:50 PM, 'Alan Donovan' via golang-nuts > wrote: > > On 14 December 2016 at 15:13, Dave Cheney > wrote: > For example, net/http contains both http client and server facilities, > because they both

Re: [go-nuts] Advice for new type of net.Conn

2016-12-14 Thread Seb Binet
On Wed, Dec 14, 2016 at 10:34 PM, wrote: > Hello All, > > I am looking for a little bit of advice for making a new client library > for SocketCAN > sockets in > Linux. > > Low level support for SockaddrCAN was just

[go-nuts] Advice for new type of net.Conn

2016-12-14 Thread elliotmr
Hello All, I am looking for a little bit of advice for making a new client library for SocketCAN sockets in Linux. Low level support for SockaddrCAN was just added to /x/sys/unix (https://github.com/golang/go/issues/16188) and now

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread peterGo
TL, To paraphrase: There are lies, damned lies, and benchmarks [statistics]. Let's use another machine. The results of your benchmarks. $ go version go version devel +96414ca Wed Dec 14 19:36:20 2016 + linux/amd64 $ go test -bench=. -cpu=4 BenchmarkMemclr_100-4 1

[go-nuts] Re: Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread Dave Cheney
On Thu, 15 Dec 2016, 07:50 Alan Donovan wrote: > On 14 December 2016 at 15:13, Dave Cheney wrote: > > For example, net/http contains both http client and server facilities, > because they both relate to the use of http. The prevailing style in other >

[go-nuts] Re: Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread 'Alan Donovan' via golang-nuts
On 14 December 2016 at 15:13, Dave Cheney wrote: > For example, net/http contains both http client and server facilities, > because they both relate to the use of http. The prevailing style in other > languages would have these placed in separate packages, one for client, one >

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread 'Thomas Zander' via golang-nuts
On 14 December 2016 at 18:35, Mauro Romano Trajber wrote: > The float to int conversion behaves different for 32 and 64 precision. > https://play.golang.org/p/-zkCNSTbNa > > Is this the correct behavior? It's a caveat for working with floating point numbers, in no way specific

[go-nuts] How to report about app crash to the monitoring server?

2016-12-14 Thread Maksim Sitnikov
Hello, I have an app with external dependencies (packages). These packages potentially can start goroutine. And this goroutine can raise (runtime) panic (poorly written etc.) and crash my app. Of course, my app will be restarted by service supervisor, but I need to send a report about each

[go-nuts] Re: Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread Dave Cheney
As an aside, I find that many programmers have a strong desire to aptly taxonomies to their work, they want to find _differences_ between two things so they can be separated and classified. I think to write successful Go, you should look for similarities and combine things with a similar

[go-nuts] Re: Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread Dave Cheney
It's pretty consistent with the message I've been pushing for a while; each package should have a well defined purpose, and that purpose should be enumerated by the pacakge's name. I find that when I apply that logic to my own projects, I tend to have less packages, not more. On Thursday, 15

Re: [go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread Dave Cheney
If you slice implements sort.Sort, you can remove duplicates using Kevin Gillete's set package. https://godoc.org/github.com/xtgo/set#Uniq On Thursday, 15 December 2016 04:15:01 UTC+11, Michael Jones wrote: > > Do we know anything about the structure of the slice? > > > > It is inherent in

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Michael Jones
Yes. 80917.65 => 32-bit IEE 754 is 0x479e0ad3 == 80917.6484375 1 .000101011010011 80917.65 => 64-bit IEE 754 is 0x40F3C15A == 80917.6500 1 .000101011010011 00110011001100110011001100110 The last part, the “…00110011001100110011001100110,” is not

Re: [go-nuts] "plugin was built with a different version..."

2016-12-14 Thread David Crawshaw
The hash is a SHA1 of the package object data, generated by the linker, cmd/link. The hash is created in the function genhash, and placed in the moduledata in the symtab method. Using a hash of the object data means a plugin has to be compiled against exactly the same package as the host binary.

Re: [go-nuts] "plugin was built with a different version..."

2016-12-14 Thread Ian Lance Taylor
[ +crawshaw ] On Wed, Dec 14, 2016 at 9:03 AM, David Norton wrote: > I'm trying to better understand how the runtime checks package versions when > using the plugin pkg. If there's a mismatch, the following error occurs at > run time: > >> plugin.Open: plugin was built with a

RE: [go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread John Souvestre
Ø there is good gist. Ø this algorithm 10x faster … I don’t believe it is faster as the slice size increases. What you propose is O(N**2) vs O(N). Try a test with a slice 10 or 100 times the size. John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com

Re: [go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread Michael Jones
Ha ha! Thought it seemed a familiar question. Sometimes they resurface and it seems kind to treat new ones fairly. I should have looked though. Thank you! -Original Message- From: on behalf of Ayan George Date: Wednesday, December 14, 2016

[go-nuts] Problems debugging golang in MacOS Visual Studio Code

2016-12-14 Thread Greymarch
I am struggling to get Visual Studio Code in MacOS to debug my golang code inside VSC. I am getting the following error when I press the debug button in VSC: "could not launch process: could not get thread count" I followed the manual instructions here:

[go-nuts] Channels and Networks together

2016-12-14 Thread Junaid Farooq
Hi eveyone, Very new to #GoLang. have been doing Elixir / Ruby / PHP and etc stuff for past 4 years. I was listening to the talk meet Go Lang. in which Rob Pike mentioned that, He and Ken talked a lot about getting Channels and networks together, but they still didnt, and he mentioned erlang

[go-nuts] "plugin was built with a different version..."

2016-12-14 Thread David Norton
I'm trying to better understand how the runtime checks package versions when using the plugin pkg. If there's a mismatch, the following error occurs at run time: plugin.Open: plugin was built with a different version of package ... > That message originates, in the runtime, here

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread ayan
On Wednesday, December 14, 2016 at 12:56:58 PM UTC-5, Ayan George wrote: > > > In fact, 80917.64 does predictably work with both types. > And I get the same results in C. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Ayan George
On 12/14/2016 12:44 PM, Jan Mercl wrote: > On Wed, Dec 14, 2016 at 6:36 PM Mauro Romano Trajber > wrote: > >> The float to int conversion behaves different for 32 and 64 precision. >> https://play.golang.org/p/-zkCNSTbNa > I may be wrong but I

Re: [go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Jan Mercl
On Wed, Dec 14, 2016 at 6:36 PM Mauro Romano Trajber wrote: > The float to int conversion behaves different for 32 and 64 precision. > https://play.golang.org/p/-zkCNSTbNa Consider https://play.golang.org/p/ZjRbP0LD22 -- -j -- You received this message because you are

[go-nuts] float32 vs float64 precision lost when casting to int

2016-12-14 Thread Mauro Romano Trajber
The float to int conversion behaves different for 32 and 64 precision. https://play.golang.org/p/-zkCNSTbNa Is this the correct behavior? I'm using go version go1.7.4 linux/amd64 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread Ayan George
On 12/14/2016 12:14 PM, Michael Jones wrote: > Do we know anything about the structure of the slice? > > Just FYI -- this thread was started on 8/11/2012 and you, Michael, even responded to it at the time.. I think it was pretty well hashed out back then and I'm not sure why this was

[go-nuts] Re: Installing two go releases side-by-side

2016-12-14 Thread aindurti
Never mind, I figured it out. As long as I export a separate $GOROOT during compile, it works fine. To sum up, I just 1. Downloaded and unpacked the source 2. cd'd into src/. exported $GOROOT_BOOTSTRAP to /usr/local/go (in my case). 3. run ./all.bash. as long as you don't add the

Re: [go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread Michael Jones
Do we know anything about the structure of the slice? It is inherent in the general notion that there must be a comparison of a new item with existing ones to establish uniqueness. Even so, knowledge about the structure of the input can make this comparison easier. If the input is

[go-nuts] Installing two go releases side-by-side

2016-12-14 Thread aindurti
I currently have the distribution "go version go1.7.1 darwin/amd64" installed. However, I'd like to test my applications on the 1.8 beta. - Is it okay to install another distribution without messing up the environment variables? - If I build from source, can I scope the installation

Re: [go-nuts] import a "main" package

2016-12-14 Thread 'Alan Donovan' via golang-nuts
On 14 December 2016 at 11:16, roger peppe wrote: > It is not possible to import main packages in general, although it does > seem to be possible to import a main package > Ah, that explains it. Thanks for the correction. Clearly I never tried importing a main package from

[go-nuts] Re: Code-base Refactoring Tool for Go , Move files from packages to sub packages

2016-12-14 Thread adonovan via golang-nuts
On Tuesday, 13 December 2016 20:06:49 UTC-5, Dave Cheney wrote: > > I advice caution, Go is not Java and does not permit circular > dependencies. The more packages you have, the greater the chance you have > of creating a circular dependency. > That's a rather dark viewpoint. Absent further

Re: [go-nuts] import a "main" package

2016-12-14 Thread roger peppe
It is not possible to import main packages in general, although it does seem to be possible to import a main package from external tests in the same directory. tst.go: 9:3: import "local/cmd/test" is a program, not an importable package I'm not why this restriction exists. On 13 Dec 2016 17:17,

[go-nuts] Re: memclr optimazation does worse?

2016-12-14 Thread peterGo
TL, For your results, it's a small increase of 1.9%. For my results, it's a small decrease of −2.03%. $ go version go version devel +232991e Wed Dec 14 05:51:01 2016 + linux/amd64 $ go test -bench=. BenchmarkMemclr_100-4 2000 115 ns/op BenchmarkLoop_100-4

[go-nuts] Re: Cache or tmp file used by golang compiler?

2016-12-14 Thread ddxgz19880813
I found my problem was caused by an unsuccessfully exited process. Thanks for your help anyway. 在 2016年12月14日星期三 UTC+1上午1:25:48,Dave Cheney写道: > > Try go install -v, you'll find the program in $GOPATH/bin. If you get no > lines of output, then the program is up to date. > > On Wednesday, 14

[go-nuts] Re: Idiomatic way to remove duplicates in a slice

2016-12-14 Thread ali oygur
there is good gist. https://gist.github.com/alioygur/16c66b4249cb42715091fe010eec7e33 12 Ağustos 2012 Pazar 06:33:54 UTC+4 tarihinde Sathish VJ yazdı: > > Is there an efficient, idiomatic way to remove duplicates in a slice? > If possible, I do want to retain the original order of items. >

[go-nuts] How can I make changes in `printer.go` affect `gofmt` tests?

2016-12-14 Thread Dave Cheney
This shouldnt be too hard. First, make sure you build go from source, and remove every trace of another version of Go from your machine. Unset GOROOT. Once you've built Go from sourxe, edit the files in place and go install / go test as normal. -- You received this message because you are