[go-nuts] Go as your first language

2018-01-15 Thread James Pettyjohn
I've had multiple occasions where I've needed to train someone to be a programmer from scratch in a Go environment. Trouble I've found is while the go texts are simple and straightforward, relatively speaking, they often written by someone who sought a better life in go, fleeing Java/C/C++. The

Re: [go-nuts] how about golang channel memory usage?

2018-01-15 Thread Lynn H
OK, get it , you means virt memory use, I test it, result data could match the table but how about res memory usage? how RES memory used in golang? 在 2018年1月16日星期二 UTC+8下午2:23:08,Jan Mercl写道: > > On Tue, Jan 16, 2018 at 4:49 AM Lynn H > > wrote: > > > not understand ur table, > > when memsize

Re: [go-nuts] how about golang channel memory usage?

2018-01-15 Thread Jan Mercl
On Tue, Jan 16, 2018 at 4:49 AM Lynn H wrote: > not understand ur table, > when memsize is 256,single channel use 6114Byte memory? Size of []byte is 3 words, assuming a 64 bit system that's 24 bytes. 256*24 = 6,144 bytes ie. size of a chan []byte with capacity 256, which is what make(chan []byte

[go-nuts] Experience Report building OCR in Go

2018-01-15 Thread Kevin Malachowski
Not sure about the GUI points: exp/shiny has worked really well for me and has existed for at least a year. I do admit that 4 years ago I tried my hand at a GUI framework for Go though... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

Re: [go-nuts] how about golang channel memory usage?

2018-01-15 Thread Lynn H
not understand ur table, when memsize is 256,single channel use 6114Byte memory? 在 2018年1月16日星期二 UTC+8上午1:46:45,Jan Mercl写道: > > > > > On Mon, Jan 15, 2018 at 6:04 PM Lynn H > > wrote: > > > so what the rules of channel size and memory usage? > > Check [0] if the formulas are correct. > > [0]

[go-nuts] Re: why can't change map when in for range statements?

2018-01-15 Thread Kevin Powick
I believe that the *delete()* function doesn't actually remove items from the map, only sets them to be ignored. i.e. The map data remains, but it is skipped during the range iteration. Regardless, I think you need to reconsider the logic of your approach to exiting the loop in the first pla

[go-nuts] Re: why can't change map when in for range statements?

2018-01-15 Thread sheepbao
Thanks reply, I know *range expression is evaluated once before beginning the loop, *but I delete map in for statements also really affected the loop. why not set to nil can't affect real map. func mapTest() { m := map[int]int{1: 1, 2: 2} for k, v := range m { println(k, v)

[go-nuts] Re: why can't change map when in for range statements?

2018-01-15 Thread Kevin Powick
On Monday, 15 January 2018 21:23:40 UTC-5, sheepbao wrote: > > I wrote this code, and why `map=nil` don't stop the loop? > ```go > > func mapTest() { > > m := map[int]int{1: 1, 2: 2} > > for k, v := range m { > > println(k, v) > > m = nil > > } > > } > > ``` > > output

[go-nuts] why can't change map when in for range statements?

2018-01-15 Thread sheepbao
I wrote this code, and why `map=nil` don't stop the loop? ```go func mapTest() { m := map[int]int{1: 1, 2: 2} for k, v := range m { println(k, v) m = nil } } ``` output: 1 1 2 2 I don't understand when I set `m = nil`, the loop is not stop. m doesn't seem

Re: [go-nuts] The side effect of calling html.Token()

2018-01-15 Thread Tong Sun
Thanks a lot for the comprehensive explanation Nigel, really appreciate it !! -- 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

Re: [go-nuts] SIGSEGV during build of Go from source

2018-01-15 Thread James Waldrop
Just to confirm, this indeed fixed things. Thanks for the quick response! On Mon, Jan 15, 2018 at 2:31 PM, James Waldrop wrote: > Aha, I did. I was cross compiling. Thank you! > > On Mon, Jan 15, 2018 at 2:27 PM Ian Lance Taylor wrote: > >> On Mon, Jan 15, 2018 at 1:43 PM, wrote: >> > >> > My

[go-nuts] therecipe/qt error from uitools

2018-01-15 Thread rob
Hi.  I'm interested in learning about therecipe/qt. I followed the instructions for the docker image.  After running qtsetup, I got an error that uitools failed to install. I don't know where to start, or if it even matters? Thx -- You received this message because you are subscribed to the

Re: [go-nuts] The side effect of calling html.Token()

2018-01-15 Thread Nigel Tao
On Sun, Jan 14, 2018 at 4:33 PM, Tong Sun wrote: > Not being able to do that, I have to save all the Token() info to different > variables, then pass all those variables to my function separately, instead > of passing merely a single tokenizer. Instead of using different variables, I'd just pass

Re: [go-nuts] Measuring low latency operations

2018-01-15 Thread matthewjuran
Another benchmarking rule is the operating system may be dynamically adjusting performance for power saving or other reasons. Be sure to disable any such features before running the benchmark. Matt On Monday, January 15, 2018 at 9:04:11 AM UTC-6, Jesper Louis Andersen wrote: > > General rules:

Re: [go-nuts] SIGSEGV during build of Go from source

2018-01-15 Thread James Waldrop
Aha, I did. I was cross compiling. Thank you! On Mon, Jan 15, 2018 at 2:27 PM Ian Lance Taylor wrote: > On Mon, Jan 15, 2018 at 1:43 PM, wrote: > > > > My bootstrap Go is a 1.9.2 binary, and I'm trying to compile Go on High > > Sierra (MacOS 10.13.2). > > > > I get a SIGSEGV during test run: >

Re: [go-nuts] SIGSEGV during build of Go from source

2018-01-15 Thread Ian Lance Taylor
On Mon, Jan 15, 2018 at 1:43 PM, wrote: > > My bootstrap Go is a 1.9.2 binary, and I'm trying to compile Go on High > Sierra (MacOS 10.13.2). > > I get a SIGSEGV during test run: > > # cmd/go terminal test > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIG

[go-nuts] SIGSEGV during build of Go from source

2018-01-15 Thread jwaldrop
My bootstrap Go is a 1.9.2 binary, and I'm trying to compile Go on High Sierra (MacOS 10.13.2). I get a SIGSEGV during test run: # cmd/go terminal test panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x110ed

Re: [go-nuts] Re: double package vendor issue

2018-01-15 Thread liming . jiang02
Thanks. This really helps in solving my problem. On Saturday, 27 February 2016 07:22:34 UTC+11, Nate Brennand wrote: > > A solution we use is simply removing all nested vendor directories: > find vendor/ -path '*/vendor' -type d | xargs -IX rm -r X >

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread tonywalker . uk
Ah ok. So I managed to get something to compile (ended up having to cast the 'const char' arguments to fopen64 to char before passing them to my go_fopen64 function but I still get: fatal: morestack on g0 zsh: trace trap LD_PRELOAD=./preload python test.py foo I'm clearly out of my depth here

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread Ian Lance Taylor
On Mon, Jan 15, 2018 at 12:36 PM, wrote: > Thanks Ian. I assume I'd include it like this: > // #include myfopen.h > And also a myfopen.c with the actual function > > But how do I ensure the fopen64 in myfopen.h is exported to override the > default? The fopen64 function written in myfopen.c will

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread tonywalker . uk
Thanks Ian. I assume I'd include it like this: // #include myfopen.h And also a myfopen.c with the actual function But how do I ensure the fopen64 in myfopen.h is exported to override the default? On Monday, January 15, 2018 at 3:05:32 PM UTC-5, Ian Lance Taylor wrote: > > The simplist workarou

[go-nuts] Experience Report building OCR in Go

2018-01-15 Thread Tad Vizbaras
Experience Report building OCR in Go: http://recoink.com/goreport -- 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

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread Ian Lance Taylor
On Mon, Jan 15, 2018 at 11:54 AM, wrote: > > Thanks Ian. This did the trick and now I'm faced with the problem of > function signatures that include 'const'. On my system, fopen is declared > thus: > extern FILE *fopen (char *p0, char *modes) __wur > But fopen64 is: > extern FILE *fopen64 (const

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread tonywalker . uk
Thanks Ian. This did the trick and now I'm faced with the problem of function signatures that include 'const'. On my system, fopen is declared thus: extern FILE *fopen (char *p0, char *modes) __wur But fopen64 is: extern FILE *fopen64 (const char *__restrict __filename, const char *__restrict __

Re: [go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread Ian Lance Taylor
On Mon, Jan 15, 2018 at 9:09 AM, wrote: > > I'm doing more experiments with created shared-object files with functions > that override syscalls and I've hit something I'd like to see if you guys > can help with. > > See a cut-down version of what I'm doing here > > There are 2 problems.. > > 1. I

Re: [go-nuts] Unexpected net/http context cancellation

2018-01-15 Thread jesse . hallam
Thank you -- that makes sense. I was initially thrown off by the fact that the connection remains open for netcat to get the full HTTP response. For posterity, another way to get the desired behaviour is to invoke netcat as follows, noting that it won't exit by itself anymore: > cat ~/tmp/paylo

Re: [go-nuts] Unexpected net/http context cancellation

2018-01-15 Thread 'Axel Wagner' via golang-nuts
I assume netcat closes the connection once it gets an EOF from stdin. Thus the server notices the client disconnecting and cancels the context, as advertised. Try running nc without piping the input in and typing it out on the console. On Mon, Jan 15, 2018 at 5:07 PM, wrote: > According to https

Re: [go-nuts] how about golang channel memory usage?

2018-01-15 Thread Jan Mercl
On Mon, Jan 15, 2018 at 6:04 PM Lynn H wrote: > so what the rules of channel size and memory usage? Check [0] if the formulas are correct. [0]: https://docs.google.com/spreadsheets/d/1BuAnHmBKWfWD9JXXi4_k9ck-rkJyDuQgCQ05s4ytJI8/edit?usp=sharing -- -j -- You received this message becaus

[go-nuts] Unexpected behaviour with LD_PRELOAD and fopen and cgo

2018-01-15 Thread tonywalker . uk
Hi there, I'm doing more experiments with created shared-object files with functions that override syscalls and I've hit something I'd like to see if you guys can help with. See a cut-down version of what I'm doing here There are 2 problems.. 1. If I r

[go-nuts] Directory structure question

2018-01-15 Thread Kim Nielsen
Hi, This is not to start a flamewar but I have been using go for a while now and then I stumpled upon a question about the way one should structure a workspace that seems to be different from several articles, the documentation and they way people structure their github repositories. First que

[go-nuts] how about golang channel memory usage?

2018-01-15 Thread Lynn H
I user golang to write tcp server recently, I'm puzzled by memoy usage with channel so I write some code for test import ( "time" ) func main() { memsize := 256 for i := 0; i < 10; i++ { go func() { m := make(chan []byte, memsize) time.Sleep(

[go-nuts] Unexpected net/http context cancellation

2018-01-15 Thread jesse . hallam
According to https://golang.org/pkg/net/http/#Request.Context: For incoming server requests, the context is canceled when the client's > connection closes, the request is canceled (with HTTP/2), or when the > ServeHTTP method returns. My expectation, then, is for the following code to block:

Re: [go-nuts] Re: How to implement Segment Tree in key/value datastore to use Google S2 geometry?

2018-01-15 Thread Jesper Louis Andersen
My intuition is that this screams S2 at the top of its lungs, provided that you can hook into the structure. It is simply storing a radix tree (PATRICIA) of S2 cells and attaching information about box bounding to all of these. This yields a compressed trie-like structure that you can probably mai

Re: [go-nuts] Measuring low latency operations

2018-01-15 Thread Jesper Louis Andersen
General rules: * If possible, use the benchmark system inside the "testing" package. It will eliminate some common mistakes in benchmarking, but keep your head straight while doing it, so you don't accidentally measure setup time, or something else which is outside the thing you are trying to test