Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-26 Thread pierre . curto
Le jeudi 26 janvier 2017 07:42:55 UTC+1, JohnGB a écrit : > > Thanks Pierre, that looks like a simple and quite clean implementation. > Although it's easier to use an iota for the numbering, does that open up > any issues with keeping the documentation up to date? I know it's easier > to pro

Re: [go-nuts] Cross Compiling and Go Native and "What is a C library"

2017-01-26 Thread Jan Mercl
On Fri, Jan 27, 2017 at 6:25 AM Aram Hăvărneanu wrote: > On Solaris the syscall interface is a private, unstable interface (just like on Windows), and the only supported way to interact with the system is through the vendor-supplied libc. Go on Solaris always uses libc, it doesn't make system cal

Re: [go-nuts] Re: -ldflags -X

2017-01-26 Thread Eric Brown
Arafath, that's kind of what I did (except I replaced the git command with my setversion.exe). It worked as expected... thank you! On Friday, January 27, 2017 at 12:43:01 AM UTC-6, Arafath M wrote: > > Hi Eric, > > Under Windows, create a bat file with following contents. It uses latest > tag f

Re: [go-nuts] Re: -ldflags -X

2017-01-26 Thread Eric Brown
Arafath, that's kind of what I did (expect I replaced the git command with my setversion.exe). It worked as expected... thank you! On Friday, January 27, 2017 at 12:43:01 AM UTC-6, Arafath M wrote: > > Hi Eric, > > Under Windows, create a bat file with following contents. It uses latest > tag f

Re: [go-nuts] Re: -ldflags -X

2017-01-26 Thread Arafath M
Hi Eric, Under Windows, create a bat file with following contents. It uses latest tag from git repo as version. echo Rebuilding App... for /f %%i in ('git describe --tags ') do set version=%%i go install -a -v -ldflags "-X main.versionBuild=%version%" Sincerely, Arafath M On Fri, Jan 27, 2017

[go-nuts] Re: -ldflags -X

2017-01-26 Thread Eric Brown
Got it to work as intended under Linux; however, compiling on Windows is a no-go. Perhaps I have to create a script, pass the output to a variable, and insert the variable into the build command? Hopefully not, so if anybody has any suggestions... it would be highly appreciated. Thanks! On T

RE: [go-nuts] Cross compile GOOS

2017-01-26 Thread John Souvestre
Hi Jakob. > I don't know the OP's reason, but environment variables are somewhat > more cumbersome on Windows. I don't think there is a way (in cmd) to > do both in one command, for example I believe that this might work. Modifying Dave's example: Set (GOOS=Darwin) & go build The () p

Re: [go-nuts] Cross Compiling and Go Native and "What is a C library"

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 9:24 PM, Aram Hăvărneanu wrote: > On Thu, Jan 26, 2017 at 7:00 PM, Jan Mercl <0xj...@gmail.com> wrote: >> or any POSIX-like OS for that matter > > On Solaris the syscall interface is a private, unstable interface > (just like on Windows), and the only supported way to inter

Re: [go-nuts] Cross Compiling and Go Native and "What is a C library"

2017-01-26 Thread Aram Hăvărneanu
On Thu, Jan 26, 2017 at 7:00 PM, Jan Mercl <0xj...@gmail.com> wrote: > or any POSIX-like OS for that matter On Solaris the syscall interface is a private, unstable interface (just like on Windows), and the only supported way to interact with the system is through the vendor-supplied libc. Go on So

[go-nuts] GOMAXPROCS survey

2017-01-26 Thread Sokolov Yura
How often your application changes GOMAXPROCS at runtime? What is the reason of this change? What patterns of this change exist (ie is it bounded, is it frequent, etc)? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 7:53 PM, T L wrote: > > On Friday, January 27, 2017 at 4:05:03 AM UTC+8, Ian Lance Taylor wrote: >> >> On Thu, Jan 26, 2017 at 11:10 AM, T L wrote: >> > >> > I still don't understand what are implicit memory allocations, could you >> > make an explanation? >> >> An example

[go-nuts] -ldflags -X

2017-01-26 Thread Eric Brown
Using -ldflags -X, is there a way to set the internal value as the output of an executable console file? I've seen examples like this: "-X main.githash=`git rev-parse HEAD`" (which would put the result of the git command w/ flags into it) however, I just can't get it to work (if it's even pos

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread T L
On Friday, January 27, 2017 at 3:38:12 AM UTC+8, Jakob Borg wrote: > > It depends. A call to new can (and will, often) give you a pointer to a > stack allocated object. If you pass that pointer to something like > fmt.Println() you'll see the object escape to the heap, get flagged by -m, > and

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread T L
On Friday, January 27, 2017 at 4:05:03 AM UTC+8, Ian Lance Taylor wrote: > > On Thu, Jan 26, 2017 at 11:10 AM, T L > > wrote: > > > > I still don't understand what are implicit memory allocations, could you > > make an explanation? > > An example of an implicit memory allocation: > > var gl

[go-nuts] Working with ioctls, structs containing uintptr, and "((packed))"

2017-01-26 Thread daniel . swarbrick
Hello, I'm trying to call Linux SCSI generic ioctls from Go, ideally without resorting to cgo, and have hit a few snags. I have ported the sg_io_hdr_t struct () to Go, and according to http://golang-sizeof.tips, it is the same size as sizeof(sg_io_hdr_t) in C, and does not contain any unexpect

Re: [go-nuts] 2.5x higher memory usage with go1.8rc2

2017-01-26 Thread tsuna
I reproduced this issue several times on Jan 24, but for some reason that still eludes me right now, I can’t reproduce it anymore. Must be PEBCAK. I’ll report back if I can reproduce it again and have some evidence to share. On Thu, Jan 26, 2017 at 1:27 PM, Aurélien Bombo wrote: > Any update on

Re: [go-nuts] 2.5x higher memory usage with go1.8rc2

2017-01-26 Thread Aurélien Bombo
Any update on this? I'm curious. Aurélien Bombo 2017-01-24 23:20 GMT+01:00 tsuna : > Hi there, > I have a linux/386 production binary that I compiled and deployed with > go1.8rc2 and I noticed that the RSS is 2.5x of the same binary doing > the same thing but compiled with go1.7.3. Anybody e

[go-nuts] Go 1.7.5 and Go 1.8rc3 are released

2017-01-26 Thread Chris Broadfoot
Hello gophers, We have just released go1.7.5, which includes fixes to the compiler, runtime, and the crypto/x509 and time packages. https://golang.org/doc/devel/release.html#go1.7.minor You can download binary and source distributions from the Go web site: https://golang.org/dl/ We also released

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread Dave Cheney
Pro tip: optimise for correctness before performance. -- 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 options,

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread lee
Thanks all, I don't use defer in a lot of the places to optimise and minimise the lock time. I suppose looking at those points is probably the safest place to start! On Thursday, January 26, 2017 at 8:07:41 PM UTC, Dave Cheney wrote: > > Start with the basics like go vet which will spot a lock

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread Dave Cheney
Start with the basics like go vet which will spot a lock being copied by value. Then check for each place you call Lock, there is a defer statement on th next line. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Cross compile GOOS

2017-01-26 Thread Dave Cheney
SET GOOS=Darwin go build -- 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 options, visit https://groups.google.c

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 11:10 AM, T L wrote: > > I still don't understand what are implicit memory allocations, could you > make an explanation? An example of an implicit memory allocation: var globalVar *int func f() { var i int globalVar = &i } Another one: var globalVar interface{}

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Jakob Borg
It depends. A call to new can (and will, often) give you a pointer to a stack allocated object. If you pass that pointer to something like fmt.Println() you'll see the object escape to the heap, get flagged by -m, and presumably forbidden by -+. //jb > On 26 Jan 2017, at 20:10, T L wrote: >

Re: [go-nuts] Cross compile GOOS

2017-01-26 Thread Jakob Borg
I don't know the OP's reason, but environment variables are somewhat more cumbersome on Windows. I don't think there is a way (in cmd) to do both in one command, for example. Maybe in Powershell, I don't speak it, but commands tend to look quite verbose there as well. //jb > On 26 Jan 2017, at

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread T L
On Friday, January 27, 2017 at 2:05:02 AM UTC+8, Ian Lance Taylor wrote: > > On Thu, Jan 26, 2017 at 9:18 AM, T L > > wrote: > > > > On Wednesday, January 25, 2017 at 5:16:07 AM UTC+8, Ian Lance Taylor > wrote: > > > >> By not allocating memory. It is helped by a "secret" compiler option,

Re: [go-nuts] Cross compile GOOS

2017-01-26 Thread Dave MacFarlane
"BSD" isn't a valid OS. It's a family of OSes.. but why don't you just set the environment variable while running the command? Such as: GOOS=dragonfly go build prog On Thu, Jan 26, 2017 at 1:10 PM, wrote: > Is there any way to cross compile without setting GOOS environment variable? > > i.e

Re: [go-nuts] Cross compile GOOS

2017-01-26 Thread Jan Mercl
On Thu, Jan 26, 2017 at 7:10 PM wrote: > go build os=bsd prog > Or is it by design that you cannot just compile using a compiler switch, you must set GOOS environment variable? $ GOOS=bsd go build prog $ go build -os bsd prog The difference in length is only one letter anyway ;-) -- -j --

[go-nuts] Cross compile GOOS

2017-01-26 Thread youtube
Is there any way to cross compile without setting GOOS environment variable? i.e. something like go build os=bsd prog Or is it by design that you cannot just compile using a compiler switch, you must set GOOS environment variable? Thanks -- You received this message because you are subscribe

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 9:18 AM, T L wrote: > > On Wednesday, January 25, 2017 at 5:16:07 AM UTC+8, Ian Lance Taylor wrote: > >> By not allocating memory. It is helped by a "secret" compiler option, >> -+. When that compiler option is used, the compiler gives an error >> for any implicit memory

[go-nuts] x/mobile/gl: blocking vs non-blocking calls

2017-01-26 Thread Roberto Zanotto
Hi. I'm looking at the source of mobile/gl. If I understand correctly, it has a mechanism to reduce the number of cgo calls: the gl calls are accumulated, until a "blocking" call is reached; when that happens, all the calls with associated arguments are passed at once to a C function, which exe

Re: [go-nuts] Cross Compiling and Go Native and "What is a C library"

2017-01-26 Thread Jan Mercl
On Thu, Jan 26, 2017 at 6:46 PM wrote: > "If you want to use any C libraries" Don't all programs use C libraries... When I use sysinternals procmon a windows Go exe uses tens (almost hundreds) of OS c libraries. On linux/bsd I have not checked, but you cannot possibly get away with doing anyt

Re: [go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread T L
On Thursday, January 26, 2017 at 11:15:39 PM UTC+8, andrey mirtchovski wrote: > > I bet you get wildly differing results with each run. That's an > indicator that your sample size is not statistically relevant (there's > randomness introduced both in the select, as well as in the OS and Go >

Re: [go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread T L
On Thursday, January 26, 2017 at 11:15:19 PM UTC+8, Jesper Louis Andersen wrote: > > Roughly, select proceeds in two passes[0]: > > 1. Figure out what select-cases have events that can fire. > 2. Pick fairly among the eligible events. Fairly means pseudo-random. > > What likely happens in your c

[go-nuts] Cross Compiling and Go Native and "What is a C library"

2017-01-26 Thread youtube
On this article" https://inconshreveable.com/04-30-2014/cross-compiling-golang-programs-with-native-libraries/ it says "If you want to use any C libraries" But, all operating systems today (relevant ones) are written in C and their tools are in C (DSO's, DLL's) so as far as I can see, you are alw

[go-nuts] Re: Get Excel Sheet Names

2017-01-26 Thread Ain
On Thursday, January 26, 2017 at 7:33:42 PM UTC+2, David Sofo wrote: > > > Hi, > > I am using this Go library https://github.com/tealeg/xlsx to to read > excel file . Is there a way to get all sheets names? Thank you. > I have not used it myself but looking at the doc: xlFile, err := xlsx.O

Re: [go-nuts] Get Excel Sheet Names

2017-01-26 Thread Shawn Milochik
https://play.golang.org/p/yvr04Jhu8c See the docs here: https://godoc.org/github.com/tealeg/xlsx I'm also a maintainer of this project, so let me know if you have any more questions. ^_^ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

[go-nuts] Re: Get Excel Sheet Names

2017-01-26 Thread David Sofo
Sorry I got it : sheet.Name is ok. David Le jeudi 26 janvier 2017 18:33:42 UTC+1, David Sofo a écrit : > > > Hi, > > I am using this Go library https://github.com/tealeg/xlsx to to read > excel file . Is there a way to get all sheets names? Thank you. > > Regards > David > -- You received this

[go-nuts] Get Excel Sheet Names

2017-01-26 Thread David Sofo
Hi, I am using this Go library https://github.com/tealeg/xlsx to to read excel file . Is there a way to get all sheets names? Thank you. Regards David -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rec

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread T L
On Wednesday, January 25, 2017 at 5:16:07 AM UTC+8, Ian Lance Taylor wrote: > > On Tue, Jan 24, 2017 at 12:46 PM, josvazg > > wrote: > > > > Golang runtime has been fully translated to Go for a while now. I know I > > could just read the source code directly but... > > > > Is there any know

[go-nuts] What if OrangeFS and AMD's HSA embedded into the golang language?

2017-01-26 Thread David Marceau
I have recently been reflecting about OrangeFS and AMD's HSA and how they eventually reach golang users. That implies somewhere there will be a cgogen generated wrapper for them somehow, then they will be used. What if OrangeFS' and HSA were deeply embedded into the go language themselves in a

[go-nuts] Re: Array Join Fail vs Slice Join Success

2017-01-26 Thread olegfx
It's because strings.Join accepts slice while *s* is array. You should use *s[:]* to get slice: fmt.Println(strings.Join(s[:], ",")) On Thursday, January 26, 2017 at 7:06:23 PM UTC+3, Joey Miller wrote: > > var s [2]string > s[0] = "PASS" > s[1] = "FAIL" > fmt.Println(strings.Join(s, ",")) > >

Re: [go-nuts] Array Join Fail vs Slice Join Success

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 7:45 AM, wrote: > var s [2]string > s[0] = "PASS" > s[1] = "FAIL" > fmt.Println(strings.Join(s, ",")) > > > The following code fails, I know this works with a slice, But I am a newbie > to go and I am trying to figure out the reason why this fails? Does it have > something

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread Ian Lance Taylor
On Thu, Jan 26, 2017 at 2:21 AM, josvazg wrote: > Thanks a lot Ian! > > My mind picture of the runtime is more detailed now. I guess for more I > should now read the code itself. > > Just one side issue. You said: > " > Memory allocated on the stack in function F can not be used by callees > of F

[go-nuts] Array Join Fail vs Slice Join Success

2017-01-26 Thread joeymiller50
var s [2]string s[0] = "PASS" s[1] = "FAIL" fmt.Println(strings.Join(s, ",")) The following code fails, I know this works with a slice, But I am a newbie to go and I am trying to figure out the reason why this fails? Does it have something to do with cap or len? -- You received this message

[go-nuts] using signed urls with cloud.google.com/go/storage

2017-01-26 Thread Christoph Hack
Hi, I feel quite stupid already, but I can not figure out how to use signed URLs with the go storage client. I have found lots of examples on how to generate signed URLs as well as a documentation on how to use them with plain HTTP requests (e.g. initial Post request and subsequent PUT requests

Re: [go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread andrey mirtchovski
I bet you get wildly differing results with each run. That's an indicator that your sample size is not statistically relevant (there's randomness introduced both in the select, as well as in the OS and Go schedulers). Increase the iterations until your results stabilize, then you'll see what the r

Re: [go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread Jesper Louis Andersen
Roughly, select proceeds in two passes[0]: 1. Figure out what select-cases have events that can fire. 2. Pick fairly among the eligible events. Fairly means pseudo-random. What likely happens in your case is that your consumer is able to empty out one of the channels which then means the other ch

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread Tamás Gulácsi
2017. január 26., csütörtök 10:20:07 UTC+1 időpontban l...@pinkfroot.com a következőt írta: > > Ok, why do you think I'm looking at too low a level, interested to > understand! > > When I look at http://127.0.0.1/debug/pprof/goroutine?debug=2 most of > the threads are in the semacquire state wa

Re: [go-nuts] Re: Idiomatic way to reference custom error codes

2017-01-26 Thread Manlio Perillo
Il giorno giovedì 26 gennaio 2017 07:37:49 UTC+1, JohnGB ha scritto: > > Since it is an HTTP Api, what about returning a standard HTTP status line, >> maybe with some non standard status code) and additional details about the >> error in the response body, JSON encoded? > > > That is exactly what

[go-nuts] Re: Priority cases in select?

2017-01-26 Thread T L
On Thursday, January 26, 2017 at 8:08:28 PM UTC+8, Volker Dobler wrote: > > [...] Fewer select-block usages means more efficient code. >> > > What if the priority-enabled-select is much complexer and > massively less efficient than two all-equal-selects? > It might be less lines of code but not i

[go-nuts] Re: Priority cases in select?

2017-01-26 Thread Volker Dobler
> > [...] Fewer select-block usages means more efficient code. > What if the priority-enabled-select is much complexer and massively less efficient than two all-equal-selects? It might be less lines of code but not in itself more efficient (for whatever definition of efficiency). V. -- You rec

[go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread T L
package main import "fmt" func main() { c0, c1 := make(chan int, 10), make(chan int, 10) go func() { for { c0 <- 0 } }() go func() { for { c1 <- 1 } }() var n0, n1 int f0 := func() { n

[go-nuts] Re: Priority cases in select?

2017-01-26 Thread T L
On Thursday, January 26, 2017 at 6:29:54 PM UTC+8, dja...@gmail.com wrote: > > > > On Wednesday, January 25, 2017 at 3:14:27 PM UTC+2, T L wrote: >> >> sometimes, I do want one case on a select block get selected even if >> there are multiple unblocked cases. >> For example, I don't want the dat

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread josvazg
Replying to myself. Here is a must read to understand the go runtime better and its source code: https://github.com/golang/go/blob/master/src/runtime/HACKING.md -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and s

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread josvazg
Also, any recommended entry point or guide to read the runtime source 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.

[go-nuts] Re: Priority cases in select?

2017-01-26 Thread djadala
On Wednesday, January 25, 2017 at 3:14:27 PM UTC+2, T L wrote: > > sometimes, I do want one case on a select block get selected even if there > are multiple unblocked cases. > For example, I don't want the dataCh case is selected if the stopCh and > the timer channel are unblocked: > > select {

Re: [go-nuts] GolangRT Docs?

2017-01-26 Thread josvazg
Thanks a lot Ian! My mind picture of the runtime is more detailed now. I guess for more I should now read the code itself. Just one side issue. You said: " Memory allocated on the stack in function F can not be used by callees of F. After F returns, the memory is gone. " I don't quite get it.

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread lee
Ok, why do you think I'm looking at too low a level, interested to understand! When I look at http://127.0.0.1/debug/pprof/goroutine?debug=2 most of the threads are in the semacquire state waiting for a RWMutex lock to free up. I'm trying to track down what/where it is stuck inside a current

Re: [go-nuts] Re: Tracking down logic lock

2017-01-26 Thread Konstantin Khomoutov
On Thu, 26 Jan 2017 07:51:11 + Lee Armstrong wrote: > > Send HUP (kill -HUP pid or pressing Ctrl+\ on the terminal), when > > the program is locked up, save the resulting stack trace, and > > inspect. It'll list all running/blocked goroutines, and the point > > of the wait, too. > Thanks, I j