[go-nuts] Re: Go 1.10 Beta 2 is released

2018-01-18 Thread Nzlov
MACOS 10.12.6 Build Error ./all.bash Building Go cmd/dist using /Users/nzlov/program/go1.4. Building Go toolchain1 using /Users/nzlov/program/go1.4. Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1. Building Go toolchain2 using go_bootstrap and Go toolchain1. Building Go toolchain

[go-nuts] Re: Go 1.10 Beta 2 is released

2018-01-18 Thread Dave Cheney
I am running the same version and do not see that errro. Have you modified your ulimit? Does your machine have any sort of antivirus or monitoring software installed? In any case, I would say you can ignore that error, Go is correctly built by that time. -- You received this message because

Re: [go-nuts] Avoiding duplication in parallel tests

2018-01-18 Thread roger peppe
> - Is there a way to avoid the extra level of Run() nesting? It's a little > annoying when specifying a command to `go test -run`. That's an interesting question. Here's one possible solution: use reference counting to clean up the resource after us. Since we can rely on the fact that all paral

Re: [go-nuts] Is there a mistake in the "Expression statements" section of Go spec?

2018-01-18 Thread Maurizio Vitale
> > It looks only a very small part of expressions can be viewed as statements. Why only a small fraction of expressions can be viewed as a statement? I agree that only a fraction can be _usefully_ used as a statement, but all are ok as statement. The key is that when using an expression as a sta

[go-nuts] Heap profiling with actual memory usage instead of allocation origin?

2018-01-18 Thread Péter Szilágyi
Hi all, We've been trying to track down a nasty memory allocation issue (i.e. a leak somewhere) for the past few months and mostly failed. A few times we thought to create a heap profile to see where the memory is at, but the heap profile only tells us where the memory was allocated (I can answe

[go-nuts] Re: Having a Model Package

2018-01-18 Thread matthewjuran
To me having packages in an application is already a code smell, my requirement is each non-main package should provide very specific functionality that could be shared between applications. I remember the Quake source code having most everything in one directory of C files, and I think Go appl

Re: [go-nuts] select case fallthrough

2018-01-18 Thread matthewjuran
For Go 2 I mentioned adding multiple cases or fallthrough for select here: https://github.com/golang/go/issues/23196 Matt On Thursday, July 11, 2013 at 12:52:15 AM UTC-5, Johann Höchtl wrote: > > On 10.07.2013 22:50, Rob Pike wrote: > > As far as the select is concerned, what you have is right.

[go-nuts] How to use `go test`?

2018-01-18 Thread pengyu . ut
Hi, I would like to use go test. But I am not sure how to use it. Could you anybody provide me with a minimal working example how to use go test? Thanks. $ cat main_test.go #!/usr/bin/env gorun // vim: set noexpandtab tabstop=2: package foo import ( "testing" ) func TestSomething(t *test

Re: [go-nuts] How to use `go test`?

2018-01-18 Thread Jan Mercl
On Thu, Jan 18, 2018 at 5:01 PM wrote: > main_test.go:1:1: illegal character U+0023 '#' The message says it all. Go is not an interpreted scripting language supporting #-style comments like bash, Python etc. -- -j -- You received this message because you are subscribed to the Google Grou

[go-nuts] Re: Go schedule latency issue

2018-01-18 Thread matthewjuran
Is your test request source running on the same computer? Have you disabled OS power management features? Matt On Thursday, January 18, 2018 at 10:23:43 AM UTC-6, sotte...@gmail.com wrote: > > I developed an RPC Service with high requirements for real-time > performance. There was an unexpecte

Re: [go-nuts] Realpath?

2018-01-18 Thread rgolan
On Monday, 16 July 2012 13:55:53 UTC+3, Rémy Oudompheng wrote: > > Did you have a look at filepath.EvalSymlinks? > > Rémy. > Confirmed to be working. Thanks Remy. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

[go-nuts] accessing fields of nil should panic, but an EXC_BAD_ACCESS in gomobile+iOS -- bug?

2018-01-18 Thread chris
Hi, I ran into this recently, and I'm not sure it's expected behavior. The Go spec says that accessing a struct field on a nil pointer should panic (example: https://play.golang.org/p/KsIyVll7NE0). This panic can be recovered from. In an iOS library built with gomobile, instead of a panic, I g

[go-nuts] Core team and internal organisation of go project

2018-01-18 Thread Davor Kapša
Hi all, How many members has core team? How are they internally organised? (How are they organised on daily bases? How many sub teams exist and how are they divided?) Are they all on Google salaries? Thanks. d. -- You received this message because you are subscribed to the Google Groups "

[go-nuts] Using reflect to call functions on struct members

2018-01-18 Thread Boone Severson
Hi, I've got structs containing custom types. I'm hoping to use reflect to create some fairly generic code to Validate() every field of a struct based on its type, but I can't seem to get the code right. Is this possible? I've set up a playground to show where I've gotten. https://play.golang

Re: [go-nuts] Re: Go 1.10 Beta 2 is released

2018-01-18 Thread Russ Cox
See also https://github.com/golang/go/issues/7381 especially https://github.com/golang/go/issues/7381#issuecomment-66091683. Russ On Thu, Jan 18, 2018 at 5:21 AM, Dave Cheney wrote: > I am running the same version and do not see that errro. Have you modified > your ulimit? Does your machine ha

Re: [go-nuts] Using reflect to call functions on struct members

2018-01-18 Thread Ayan George
On 01/18/2018 01:28 PM, Boone Severson wrote: > Hi, > > I've got structs containing custom types. I'm hoping to use reflect > to create some fairly generic code to Validate() every field of a > struct based on its type, but I can't seem to get the code right. Is > this possible? I've set up a pl

Re: [go-nuts] Core team and internal organisation of go project

2018-01-18 Thread Jan Mercl
On Thu, Jan 18, 2018 at 7:28 PM Davor Kapša wrote: > How many members has core team? > > How are they internally organised? > (How are they organised on daily bases? How many sub teams exist and how are they divided?) > > Are they all on Google salaries? Confidential information, I guess. --

Re: [go-nuts] Core team and internal organisation of go project

2018-01-18 Thread matthewjuran
The contributors are explorable here: https://github.com/golang/go/graphs/contributors Matt On Thursday, January 18, 2018 at 12:42:03 PM UTC-6, Jan Mercl wrote: > > On Thu, Jan 18, 2018 at 7:28 PM Davor Kapša > wrote: > > > How many members has core team? > > > > How are they internally organi

Re: [go-nuts] Using reflect to call functions on struct members

2018-01-18 Thread Boone Severson
Thank you for the response. I've chosen to have Validate() receive a copy of the value, but I still can't find Validate() in the list of Methods: https://play.golang.org/p/uCeCB-wv4Ku (run to see output) Any further advice? Thanks in advance. On Thursday, January 18, 2018 at 10:40:34 AM UTC-8,

Re: [go-nuts] Using reflect to call functions on struct members

2018-01-18 Thread Boone J. Severson
(for completeness and future reference, I found how Addr() will let me use a pointer receiver https://play.golang.org/p/JSKduIPDV2e . However, I'm still at the place I was in the Go Playground link mentioned immediately above) On Thu, Jan 18, 2018 at 11:14 AM, Boone Severson wrote: > Thank you

Re: [go-nuts] Re: Experience Report building OCR in Go

2018-01-18 Thread Tyler Compton
In the Error Handling section, you mention having to write a special package to capture stack traces. Would https://github.com/pkg/errors have done what you want? On Tue, Jan 16, 2018 at 6:18 AM Tad Vizbaras wrote: > I used "walk" for prototyping but found it too complex. I do not mean this > as

Re: [go-nuts] Re: Experience Report building OCR in Go

2018-01-18 Thread Tad Vizbaras
Yes, that what I have used. I feel that package https://github.com/pkg/errors is good enough to be in the standard library. At least part of it that does stack trace. In all respects Go worked very well for this project. -- You received this message because you are subscribed to the Google Gr

[go-nuts] Badger Write Performance

2018-01-18 Thread dc0d
Badger write performance is a bit worse than boltdb. And badger suggests to batch writes. But so does boltdb. At the same time at badger's GitHub page it says it has higher write performance compared to boltdb. Is there a sample of how to do high performance/throughput writes with badger? --

Re: [go-nuts] Core team and internal organisation of go project

2018-01-18 Thread Ian Lance Taylor
On Thu, Jan 18, 2018 at 9:23 AM, Davor Kapša wrote: > > How many members has core team? > > How are they internally organised? > (How are they organised on daily bases? How many sub teams exist and how are > they divided?) > > Are they all on Google salaries? We do use the phrase "core team" loos

Re: [go-nuts] Core team and internal organisation of go project

2018-01-18 Thread Davor Kapša
Thanks Ian. On Thursday, January 18, 2018 at 9:14:52 PM UTC+1, Ian Lance Taylor wrote: > > On Thu, Jan 18, 2018 at 9:23 AM, Davor Kapša > wrote: > > > > How many members has core team? > > > > How are they internally organised? > > (How are they organised on daily bases? How many sub teams e

Re: [go-nuts] Using reflect to call functions on struct members

2018-01-18 Thread Boone Severson
Ok, asked and answered. Figuring out .Addr() was a key, as was finding the magic incantation to get a handle to a method. I'm curious if there's a better method. https://play.golang.org/p/49Yj9G0egRI package main import ( "fmt" "reflect" ) type FooTypeA uint8 type FooTypeB uint8 type MyStruc

[go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Peng Yu
Hi, The following example shows how to write a byte slice to a buffer. But what if I want only write a length shorter (say 2 instead of 5) than the size of the slice. Is there a function that allows users to specify the length to write? Thanks. $ cat main.go #!/usr/bin/env gorun // vim: set noexp

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Bruno Albuquerque
n, err := f.Write(d[:length]) ? Where length is the amount of data you want to write. On Thu, Jan 18, 2018 at 3:04 PM Peng Yu wrote: > Hi, > > The following example shows how to write a byte slice to a buffer. But > what if I want only write a length shorter (say 2 instead of 5) than > the size

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Dan Kortschak
If you want to write a length shorter than the slice, make the slice shorter. No, seriously... n, err := f.Write(d[:2]) On Thu, 2018-01-18 at 17:04 -0600, Peng Yu wrote: > Hi, > > The following example shows how to write a byte slice to a buffer. > But > what if I want only write a length shorte

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Peng Yu
Dan & Bruno, I didn't realize that it is as simple as that :) Thanks. Does it involve any extra copy of the byte slice? Or f.Write literally access the memory of d and only access 2 bytes of data for writing to the buffer? On Thu, Jan 18, 2018 at 5:13 PM, Dan Kortschak wrote: > If you want to w

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Bruno Albuquerque
It creates a new slice header, but the backing array is not copied. On Thu, Jan 18, 2018 at 3:35 PM Peng Yu wrote: > Dan & Bruno, > > I didn't realize that it is as simple as that :) Thanks. > > Does it involve any extra copy of the byte slice? Or f.Write literally > access the memory of d and o

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Bruno Albuquerque
Actually, it is even possible that not even a new slice header is created in this case, but I did not check. On Thu, Jan 18, 2018 at 3:56 PM Bruno Albuquerque wrote: > It creates a new slice header, but the backing array is not copied. > > On Thu, Jan 18, 2018 at 3:35 PM Peng Yu wrote: > >> Da

Re: [go-nuts] Re: Go 1.10 Beta 2 is released

2018-01-18 Thread Nzlov
thx. On Friday, January 19, 2018 at 2:30:17 AM UTC+8, Russ Cox wrote: > > See also https://github.com/golang/go/issues/7381 especially > https://github.com/golang/go/issues/7381#issuecomment-66091683. > > Russ > > > On Thu, Jan 18, 2018 at 5:21 AM, Dave Cheney > wrote: > >> I am running the same

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Marvin Renich
* Peng Yu [180118 18:37]: > Dan & Bruno, > > I didn't realize that it is as simple as that :) Thanks. > > Does it involve any extra copy of the byte slice? Or f.Write literally > access the memory of d and only access 2 bytes of data for writing to > the buffer? The blog entry https://blog.gola

[go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2018-01-18 Thread derek
like for 1.8 1.6 for archeology and other reasons, I am researching a in-house software written in Golang1.6 want an online version of golang1.6 doc? https://golang.org/doc/go1.6/pkg/encoding/json/ https://golang.org/pkg/encoding/json/ as I'm checking here is always pointing to latest version?

[go-nuts] Re: [golang-dev] Go 1.10 Beta 2 is released

2018-01-18 Thread Krzysztof Kowalczyk
Make sure to disable anti-virus software. Such software hooks into file operations in order to scan files for viruses and can keep files open longer than you expect. That would be consistent with the error message you're seeing. This is not limited to anti-virus software but it's most common wi

[go-nuts] what does 'go.info,go.range' mean in golang asm?

2018-01-18 Thread sheepbao
I wrote this code add.go: package asm func add(a, b int) int { return a + b } then I compile this code to asm: go tool compile -S add.go the output is: "".add STEXT nosplit size=19 args=0x18 locals=0x0 0x 0 (add.go:3) TEXT"".add(SB), NOSPLIT, $0-24 0x 0 (add.go:3) FUN

[go-nuts] turning a /proc/$pid/stat startTime into "seconds since this process started"

2018-01-18 Thread andrew . george . hammond
I want to find out how long a process has been running. I'm grabbing the starttime out of /proc/$pid/stat for a process. This is in "in clock ticks (divide by sysconf(_SC_CLK_TCK))." according to http://man7.org/linux/man-pages/man5/proc.5.html I also have Sysinfo.Uptime (seconds since boot). M

Re: [go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2018-01-18 Thread Ian Lance Taylor
On Thu, Jan 18, 2018 at 5:32 PM, derek wrote: > like for 1.8 1.6 > > for archeology and other reasons, I am researching a in-house software > written in Golang1.6 > want an online version of golang1.6 doc? > > https://golang.org/doc/go1.6/pkg/encoding/json/ > > https://golang.org/pkg/encoding/json

Re: [go-nuts] what does 'go.info,go.range' mean in golang asm?

2018-01-18 Thread Ian Lance Taylor
On Thu, Jan 18, 2018 at 6:21 PM, sheepbao wrote: > > I wrote this code add.go: > package asm > > func add(a, b int) int { >return a + b > } > > then I compile this code to asm: > go tool compile -S add.go > the output is: > "".add STEXT nosplit size=19 args=0x18 locals=0x0 >0x 0 (a

Re: [go-nuts] turning a /proc/$pid/stat startTime into "seconds since this process started"

2018-01-18 Thread Caleb Spare
You can do it with cgo. I have some code that does this: // #include import "C" func init() { clockTicksPerSec = float64(C.sysconf(C._SC_CLK_TCK)) if clockTicksPerSec != 100 { log.Println("Unusual _SC_CLK_TCK value:", clockTicksPerSec) } } var clockTicksP

[go-nuts]

2018-01-18 Thread 王晚成
hello my dear friend Google man: I have some questions. type Point struct{ x int y int } func (p *Point) hehe(i int) { p.x = i p.y = i } func main(){ Point{1,2}.hehe(4) // compile error: can't take address of Point literal } The book says that there’s no way to obtain the add

[go-nuts] Re:

2018-01-18 Thread Volker Dobler
Point{1,2} is not a temporary variable but a literal and these do have addresses. Just not automatically. V. On Friday, 19 January 2018 07:26:04 UTC+1, 王晚成 wrote: > > hello my dear friend Google man: > I have some questions. > > type Point struct{ > x int >y int > } > > func (p

[go-nuts] Re: Go schedule latency issue

2018-01-18 Thread sotter . liu
a. request client and server running on the same computer. b. Unfortunately, I have not find the method how to disable OS power management. I re-running this case on linux server, result shows that there is almost no time out. I suspect the P's block is affected by the external operating envir

Re: [go-nuts] Re:

2018-01-18 Thread Jan Mercl
On Fri, Jan 19, 2018 at 7:48 AM Volker Dobler wrote: > Point{1,2} is not a temporary variable but a literal > and these do have addresses. Just not automatically. Did you mean &Point{1, 2}? Otherwise Point{1, 2} is a non-addressable value like 42. Literals do not have addresses before assigned t