[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread P Q
2016년 12월 16일 금요일 오전 11시 5분 53초 UTC+9, Peng Wang 님의 말: Actually I don't really care about that, just don't want break the interface requirement in the doc it says "WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <=

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread P Q
2016년 12월 16일 금요일 오전 11시 5분 53초 UTC+9, Peng Wang 님의 말: > > Actually I don't really care about that, just don't want break the > interface requirement > in the doc it says "WriteAt writes len(p) bytes from p to the underlying > data stream at offset off. It returns the number of bytes written from

Re: [go-nuts] Re: Go on AIX

2016-12-15 Thread Gulácsi Tamás
Great news! I'm in need for that! Can you share it somehow? scchang ezt írta (időpont: 2016. dec. 16., P 6:42): > Not sure if ppl in this thread are still interested. I managed to get > gccgo (included in gcc 4.8.4) to work on AIX 5.3. The bulk of the changes > are indeed in the xcoff reader as

Re: [go-nuts] Re: Go on AIX

2016-12-15 Thread Ian Lance Taylor
On Thu, Dec 15, 2016 at 9:42 PM, scchang wrote: > Not sure if ppl in this thread are still interested. I managed to get gccgo > (included in gcc 4.8.4) to work on AIX 5.3. The bulk of the changes are > indeed in the xcoff reader as Ian and others had suggested. xcoff writer > also has a couple of

[go-nuts] How to speed up execution time for a set of regular expressions

2016-12-15 Thread Damian Gryski
I wrote a quick tutorial on using ragel to speed up matching regular expressions in Go. https://medium.com/@dgryski/speeding-up-regexp-matching-with-ragel-4727f1c16027 I had planned on writing a few more I n using some of ragels other features for matching things. I have an example of a ragel-

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Gulácsi Tamás
I think this is a little bit gray area. I don't really depend on the logger, as I use the global/default instance if not provided in the Context. AFAIK Context is for the actual request, it should hold values only that specific for that request. A logger instrumented with that request (ID, parsed

Re: [go-nuts] Re: [ANN] browse

2016-12-15 Thread Adrian Lanzafame
Awesome project! On Fri, 16 Dec 2016 at 11:16 Dave Cheney wrote: > This is really impressive! > > On Friday, 16 December 2016 12:08:07 UTC+11, Jan Mercl wrote: > > https://github.com/cznic/browse > > Browse packages in the terminal. The "rough at the edges" release. > > -- > > -j > > -- > You re

Re: [go-nuts] Re: Go on AIX

2016-12-15 Thread scchang
Not sure if ppl in this thread are still interested. I managed to get gccgo (included in gcc 4.8.4) to work on AIX 5.3. The bulk of the changes are indeed in the xcoff reader as Ian and others had suggested. xcoff writer also has a couple of issues as the default assembler could not understand

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread Peng Wang
OK, this point of view seems fair enough, I can take that. But won't a normal user would expect that // FooBuffer is some kind of buffer that fails randomly w := FooBuffer(conn) n ,err := m.WriteTo(w) // if binary.Write returns error, n will be 0, buf actual bytes may not be zero. // n == w.Buffe

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread Peng Wang
Then I should deal with the encoding of all the envelope fields. This envelope seems to be simple, but i got a more complicated one in the real dev works. 在 2016年12月16日星期五 UTC+8上午10:44:27,ma...@influxdb.com写道: > > > > On Thursday, December 15, 2016 at 6:05:53 PM UTC-8, Peng Wang wrote: >> >> Act

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

2016-12-15 Thread Sokolov Yura
I suppose, prefetch instructions in AVX loop (for block after current) can solve this issue. -- 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

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

2016-12-15 Thread Sokolov Yura
Memory is slow. While slice fits to cache, memclr is measurably faster. When slice doesn't fit cache, memclr at least not significantly faster. I've heard, adaptive prefetching is turned on if there were 3 consequent accesses to same cache-line in increasing address order. So, perhaps optimised

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread Tamás Gulácsi
Think from the other side: Write should return the number of bytes successfully written bytes of the input slice, to allow the caller to retry from there. If your writer writes the bytes in hex, that means it will effectively write 2n bytes, but must report back n! Or a compressor may write les

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

2016-12-15 Thread T L
On Friday, December 16, 2016 at 12:36:47 AM UTC+8, rd wrote: > > TL, > > As peterGo, I was unable to reproduce your findings: > > uname -a > Linux 4.8.0-30-generic #32-Ubuntu SMP Fri Dec 2 03:43:27 UTC 2016 x86_64 > x86_64 x86_64 GNU/Linux > > go version > go version go1.7.4 linux/amd64 > > cat

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread mark
On Thursday, December 15, 2016 at 6:05:53 PM UTC-8, Peng Wang wrote: > > Actually I don't really care about that, just don't want break the > interface requirement > in the doc it says "WriteAt writes len(p) bytes from p to the underlying > data stream at offset off. It returns the number of by

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

2016-12-15 Thread 'Alan Donovan' via golang-nuts
On 15 December 2016 at 19:52, Dave Cheney wrote: > How do aliases help this situation? In my view they'll just obscure the > true source of the declaration. > People in a hurry will continue to create bad dependencies whether or not we have aliases, but perhaps aliases might help us reduce the nu

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread 彭望
Actually I don't really care about that, just don't want break the interface requirement in the doc it says "WriteAt writes len(p) bytes from p to the underlying data stream at offset off. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the

[go-nuts] Re: [ANN] browse

2016-12-15 Thread Dave Cheney
This is really impressive! On Friday, 16 December 2016 12:08:07 UTC+11, Jan Mercl wrote: > > https://github.com/cznic/browse > > Browse packages in the terminal. The "rough at the edges" release. > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "gol

[go-nuts] [ANN] browse

2016-12-15 Thread Jan Mercl
https://github.com/cznic/browse Browse packages in the terminal. The "rough at the edges" release. -- -j -- 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 golan

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

2016-12-15 Thread Michael Jones
go version go1.7.4 linux/amd64 BenchmarkMemclr_100-36 531.5 ns/op BenchmarkLoop_100-36 271.7 ns/op BenchmarkMemclr_1000-36 5000 257 ns/op BenchmarkLoop_1000-36 2000 612 ns/op BenchmarkMemclr_1-36 500

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

2016-12-15 Thread Dave Cheney
How do aliases help this situation? In my view they'll just obscure the true source of the declaration. On Fri, 16 Dec 2016, 02:46 Alan Donovan wrote: > On 15 December 2016 at 04:38, roger peppe wrote: > > In my experience it is very common for circular dependencies to arise > not because > of

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

2016-12-15 Thread Dave Cheney
You never need to set GOROOT and setting GOROOT will bring you confusing problems to debug in the future. On Friday, 16 December 2016 11:24:20 UTC+11, Akhil Indurti wrote: > > Yeah, I don't set $GOROOT, but $GOROOT_BOOTSTRAP in order to compile. > > Symlinking might be a good idea for convenienc

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

2016-12-15 Thread Akhil Indurti
Yeah, I don't set $GOROOT, but $GOROOT_BOOTSTRAP in order to compile. Symlinking might be a good idea for convenience, but can I use my system-wide $GOPATH to test my src, or do I duplicate that as well. Thank You On Dec 15, 2016 4:54 PM, "Dave Cheney" wrote: You can build as many different v

[go-nuts] Re: Can searchbox on golang.org be improved?

2016-12-15 Thread Tim K
Instant search would be nice, in particular for APIs. Google surely has the technology to improve the search box on golang.org Meanwhile, for API searches you can use: http://devdocs.io/go/ Or desktop apps such as Dash (Mac) or Zeal (Win/Linux). On Thursday, December 15, 2016 at 7:59:44 AM UTC

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Dragos Harabor
You may or may not agree with this but Peter makes the strong point of making all dependencies explicit (skip to around 31:40 if you don't want to watch it all): https://www.infoq.com/presentations/go-patterns Even "hiding" the logger in Context is questionable many times. And yes, it may make

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

2016-12-15 Thread Dave Cheney
You can build as many different versions of Go as you need by checking the source out into different locations and running the src/make.bash script. You should not set GOROOT, building from source will encode the correct location into the bin/go tool during the process. To make life simpler for

[go-nuts] Go 1.8 Beta 2 is released

2016-12-15 Thread Chris Broadfoot
Hello gophers, We have just released go1.8beta2, a beta version of Go 1.8. It is cut from the master branch at the revision tagged go1.8beta2. Thank you to everyone who has helped to test Go 1.8 so far. We still need more people to test! Your help is invaluable. It is important that we find bugs

[go-nuts] Re: How many bytes binary.Write write before an error?

2016-12-15 Thread Tamás Gulácsi
2016. december 15., csütörtök 17:36:47 UTC+1 időpontban 彭望 a következőt írta: > > Hi all, I'm doing a simple message serialization, message defines like > below: > type Envelope struct { > Magic uint32 > DataSize uint32 > } > > type Message struct { > Envelope > Data []byte > } >

Re: [go-nuts] Looking for specific golang plush toy

2016-12-15 Thread Rob Pike
THAT SPECIFIC plush toy is the original prototype. He's not for sale. There are plenty of his siblings in the world, though, and you should be able to find one. I don't know why squishable.com doesn't keep them stocked. There does seem to be enough demand. -rob On Fri, Dec 16, 2016 at 3:41 AM,

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

2016-12-15 Thread Manlio Perillo
However importing a main package in another main package works. To summarize: 1) importing a main package in a external test is supported 2) importing a main package in a main package is supported 3) importing a main package in a non main package is not supported This seems reasonable to me, howe

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

2016-12-15 Thread Pablo Rozas Larraondo
Thanks Ian, So if I understand it well, this involves using clang compiler instead of the default gcc when building Go code that uses cgo. I'll do some research on how to do this. Cheers, Pablo On Wed, Dec 14, 2016 at 5:36 PM, Ian Lance Taylor wrote: > On Wed, Dec 14, 2016 at 4:57 PM, Pablo Ro

[go-nuts] Re: error when json unmarshaling string to type string

2016-12-15 Thread Sathish VJ
Oh, ok. Thank you for clarifying that for me. On Thursday, 15 December 2016 21:27:12 UTC+5:30, Chris Hines wrote: > > You are right, my analogy was incorrect. I didn't realize that ",string" > was a documented annotation in the json package. I've never had cause to > use it. My apologies for

[go-nuts] Looking for specific golang plush toy

2016-12-15 Thread Greymarch
Willing to pay good money for the follow Go gopher plush toy: https://blog.golang.org/gopher/plush.jpg Google no longer sells this on their merchandise website. If you know where I can buy THIS SPECIFIC plush toy, or you have one for sale, please either post the link to this thread or DM m

[go-nuts] How many bytes binary.Write write before an error?

2016-12-15 Thread pw2191195
Hi all, I'm doing a simple message serialization, message defines like below: type Envelope struct { Magic uint32 DataSize uint32 } type Message struct { Envelope Data []byte } and I want to implement the io.WriterTo interface for Message func (m *Message) WriteTo(w io.Writer) (n

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

2016-12-15 Thread rd
TL, As peterGo, I was unable to reproduce your findings: uname -a Linux 4.8.0-30-generic #32-Ubuntu SMP Fri Dec 2 03:43:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux go version go version go1.7.4 linux/amd64 cat /proc/cpuinfo CPU Intel(R) Core(TM) i7-6560U CPU @ 2.20GHz go test -bench=. [...] B

[go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread zhexuany
I compile your snippet in `Ubuntu`. It doesn't work either. cheers On Thursday, December 15, 2016 at 7:51:28 PM UTC+8, DM wrote: > > I am trying to execute the cgo program as mentioned here > > > package main > > /* > #include "runtim

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

2016-12-15 Thread Alper Köse
Hi, you can also use docker. There are official docker images in docker hub: https://hub.docker.com/_/golang/ As shown in the docker hub page, you can use the command: docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang:1.6 go build This way you can easily use whichever versio

[go-nuts] package containing standard CA roots?

2016-12-15 Thread Alex Flint
Does anyone know of a golang package that embeds (go-bindata or similar) a reasonable standard set of CA roots? Ideally such a package would provide a ready-to-use http.Client. For context, I'm building minimal docker images containing go binaries that need to make https connections to some third

[go-nuts] Can searchbox on golang.org be improved?

2016-12-15 Thread gauravk
Hello, I was looking for a way to set GC tracing for Go program. Searching for 'GC tracing' gives nothing 'gc trace' leads to code comments in source file which are detailed and useful if I already know how to set Godebug env var. And then search for 'Godebug' also does not give a clear way to

[go-nuts] Re: error when json unmarshaling string to type string

2016-12-15 Thread Chris Hines
You are right, my analogy was incorrect. I didn't realize that ",string" was a documented annotation in the json package. I've never had cause to use it. My apologies for the misleading comment. The package docs it say: The "string" option signals that a field is stored as JSON inside a > JSON

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

2016-12-15 Thread 'Alan Donovan' via golang-nuts
On 15 December 2016 at 04:38, roger peppe wrote: > > In my experience it is very common for circular dependencies to arise > not because > of something in a package that I'm using directly, but because of > something semi-related that > happens to sit in the same package. > That's a good point.

[go-nuts] Re: error when json unmarshaling string to type string

2016-12-15 Thread Sathish VJ
I don't think your analogy is right. The example you gave is an error, as if we wrote: var i = float64("hello") Whereas, the code I wrote is just being explicit when it is ok to be implicit. So, more like we wrote: var i1 = 3.142 var i2 = float64(3.142) i3 := float64(3.142) The float64 castin

[go-nuts] private repository .git and import paths

2016-12-15 Thread Sotirios Mantziaris
Hi, my problem is a follows. The repo lives in the following git repo http://some/app.git when i go get the repo the folder structure mimics the URL so i end up with a local folder app.git. As a result go install generates a binary named app.git instead of plain app. All imports look like this

[go-nuts] Re: error when json unmarshaling string to type string

2016-12-15 Thread Chris Hines
Suppose instead of `json:"s,string"` you had typed `json:"s,omitemptyy"` when you meant to type `json:"s,omitempty"`. Would you want to be told that you had an error in your struct tag? In general Go has a fail-fast philosophy to help prevent mistakes from persisting in a system unnoticed for a

[go-nuts] Announcing Gogland – Brand New Go IDE from JetBrains

2016-12-15 Thread Florin Pățan
Hi all, I'm very excited to announce a new episode in the life of the Go plugin for IntelliJ. About three years ago, Sergey Ignatov and Alexander Zolotov started a major rewrite of the plugin that took it to a working state. Since then they've made more than 3000 commits, working day and n

[go-nuts] Re: Channels and Networks together

2016-12-15 Thread Caleb Doxsey
The challenge with the design of channels, is they need to be reliable to work properly, and networks are anything but reliable. Channels only really make sense within a single process. That said, there have been libraries developed which help make working with distributed systems easier The c

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

2016-12-15 Thread mhhcbon
hi, https://github.com/mitchellh/panicwrap ? https://github.com/mitchellh/panicwrap/blob/master/panicwrap.go#L145 to go a little further, https://github.com/mh-cbon/report-panic/blob/master/demo/demo.go#L12 ? On Thursday, December 15, 2016 at 11:08:34 AM UTC+1, Maksim Sitnikov wrote: > > > On

[go-nuts] error when json unmarshaling string to type string

2016-12-15 Thread Sathish VJ
I have a struct that maps json of type string to a string. S string `json:"s,string"` When run with that, it gives me the error: Error: json: invalid use of ,string struct tag, trying to unmarshal "hello" into string I know that it is not really required. But does it have to error out? Is the

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Debraj Manna
Actually that is my problem changing all functions to pass on the context. On 15-Dec-2016 6:51 pm, "Gulácsi Tamás" wrote: > Debraj Manna ezt írta (időpont: 2016. dec. > 15., Cs, 14:12): > > If I get you correctly I still have to pass the Context (with logger > attached) to all the functions whe

[go-nuts] Error on play.golang.org?

2016-12-15 Thread Sathish VJ
I'm getting a server error on play.golang.org when I try to share my code. Are others also seeing it? It just says Server error: try again. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving email

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Gulácsi Tamás
Debraj Manna ezt írta (időpont: 2016. dec. 15., Cs, 14:12): If I get you correctly I still have to pass the Context (with logger attached) to all the functions where I wish to do the logging. If my understanding is not correct then can you please give me a small example? No, you're right: you h

[go-nuts] Re: Channels and Networks together

2016-12-15 Thread Mandolyte
Not to my knowledge. But if your goal is distributed computing, then take a look at https://github.com/chrislusf/glow On Wednesday, December 14, 2016 at 1:03:41 PM UTC-5, Junaid Farooq wrote: > > Hi eveyone, Very new to #GoLang. have been doing Elixir / Ruby / PHP and > etc stuff for past 4 year

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Debraj Manna
If I get you correctly I still have to pass the Context (with logger attached) to all the functions where I wish to do the logging. If my understanding is not correct then can you please give me a small example? On Thu, Dec 15, 2016 at 6:33 PM, Gulácsi Tamás wrote: > Just attach your pimped log

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Gulácsi Tamás
Just attach your pimped logger to the Context, and use some structured logger such as github.com/go-kit/kit/log, and pass a logger.With("reqid", reqID) specialized logger. Way easier than hacking out the goroutine id just to have a goroutine-local storage, and waay more reliable - for example you

Re: [go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Debraj Manna
Exactly for the same use case as mentioned in this thread https://groups.google.com/forum/#!msg/golang-nuts/zuWWBHKn6iw/FKjTGPItzcYJ On Thu, Dec 15, 2016 at 5:44 PM, Tamás Gulácsi wrote: > 2016. december 15., csütörtök 12:51:28 UTC+1 időpontban DM a következőt > írta: >> >> I am trying to execu

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

2016-12-15 Thread Tamás Gulácsi
2016. december 15., csütörtök 13:12:16 UTC+1 időpontban Maksim Sitnikov a következőt írta: > > Justin, Your suggestion seems to be the only viable solution at the > moment. Thank you. > > But if there is anything else, will be glad to hear. > > runit has a nice feature: if you have a "finish" exe

[go-nuts] Re: cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread Tamás Gulácsi
2016. december 15., csütörtök 12:51:28 UTC+1 időpontban DM a következőt írta: > > I am trying to execute the cgo program as mentioned here > > > That's not a cgo program there, but a Go program, which uses the gc compiler's affinity to compile

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

2016-12-15 Thread Maksim Sitnikov
Justin, Your suggestion seems to be the only viable solution at the moment. Thank you. But if there is anything else, will be glad to hear. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] cgo - 'runtime.h' file not found in MacOSX

2016-12-15 Thread DM
I am trying to execute the cgo program as mentioned here package main /* #include "runtime.h" int goId() { return g->goid; } */ import "C" import "fmt" func main() { x := C.goId() fmt.Prin

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

2016-12-15 Thread Justin Israel
On Thu, Dec 15, 2016, 11:08 PM Maksim Sitnikov wrote: > > On Thursday, December 15, 2016 at 12:23:48 PM UTC+4, Dave Cheney wrote: > > The stack trace is written to stderr, export GOTRACEBACK=all if you want a > stack trace of all goroutines not just the one that faulted. > > > Thanks you. Yes, i

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

2016-12-15 Thread Maksim Sitnikov
On Thursday, December 15, 2016 at 12:23:48 PM UTC+4, Dave Cheney wrote: > > The stack trace is written to stderr, export GOTRACEBACK=all if you want a > stack trace of all goroutines not just the one that faulted. Thanks you. Yes, it is. But how can I send it? App crashes when there is a pani

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

2016-12-15 Thread T L
On Thursday, December 15, 2016 at 6:50:14 AM UTC+8, not...@google.com wrote: > > 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/g

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

2016-12-15 Thread roger peppe
On 14 December 2016 at 21:11, Dave Cheney wrote: > I've retired hurt from the alias debate, but I'll bet you a steak dinner > next time I'm in NYC that aliases will have caused an unexpected increase in > circular dependency problems because aliases obscure the true declaration of > a symbol. The

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

2016-12-15 Thread Dave Cheney
The stack trace is written to stderr, export GOTRACEBACK=all if you want a stack trace of all goroutines not just the one that faulted. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fro