Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread roger peppe
On 26 April 2017 at 11:03, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, Apr 26, 2017 at 11:58 AM roger peppe wrote: > >> FWIW I have seen real problems in production where long-running worker > goroutines stopped working. We looked into it and found that certain rare > requests were panicking, no

[go-nuts] Re: Assign a string representation to an enum/const

2017-04-26 Thread Henry
Create a normal enum and use go generate with stringer. See https://blog.golang.org/generate If that doesn't work for you, you may consider writing your own function and use it with go generate. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" g

[go-nuts] RTP/RSTP and OVNIF?

2017-04-26 Thread pgrunwald
I searched but did not find anything. Has RTP/RSTP and/or ONVIF been implemented in Go? If not, any recommendations on how to get started? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Overriding cgo version

2017-04-26 Thread Ian Lance Taylor
[ + mpvl ] On Wed, Apr 26, 2017 at 4:39 PM, James Pettyjohn wrote: > I just updated my dependency on golang.org/x/text and found they added a > hard depedency on ICU 57. > >> ld: library not found for -licui18n.57 >> clang: error: linker command failed with exit code 1 (use -v to see >> invocatio

[go-nuts] Overriding cgo version

2017-04-26 Thread James Pettyjohn
I just updated my dependency on golang.org/x/text and found they added a hard depedency on ICU 57. ld: library not found for -licui18n.57 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) Trying to build this on a mac where homebrew installed icu4c as it bring

Re: [go-nuts] How to get current goroutine id?

2017-04-26 Thread eric . hoffman
I agree. its great to actively discourage thread local state. but I'm in the same position, debugging a concurrency problem with 3rd party libraries, have a case where it never happens, and a case where it always happens. so this would help me verify my assumptions and track down whats going on

[go-nuts] Re: Oracle db and panics on interrupt

2017-04-26 Thread Tamás Gulácsi
2017. április 26., szerda 20:33:13 UTC+2 időpontban Pierre Curto a következőt írta: > > Hello, > > I am unsure where to log the following issue: > whenever I send an interrupt signal to a go process running an Oracle > query, it panics with either "fatal: morestack on g0" or "fatal error: > runt

[go-nuts] Re: How to do OS Authentication in Oracle with Go?

2017-04-26 Thread Tamás Gulácsi
2017. április 25., kedd 21:46:27 UTC+2 időpontban Tieson Molly a következőt írta: > > Tamás, I was looking for a way to have the OS handle the authentication > for the Oracle connection. That is one of the options where you pass an > empty username and password. Didier provided a detailed l

Re: [go-nuts] Re: Assign a string representation to an enum/const

2017-04-26 Thread Tong Sun
The problem of all code I've seen so far is that they are all demonstrate half the solution, i.e., the conversion goes one way. I know it's an easy fix, but none the less, for me it's still half solution, because I need to get and *validate *the enum as *user input* from command line, but use s

Re: [go-nuts] Re: Assign a string representation to an enum/const

2017-04-26 Thread Edward Muller
FWIW, I wouldn't use an "enum" (those don't exist in go) and would probably do something like this: https://play.golang.org/p/J6_hssueao On Wed, Apr 26, 2017 at 11:41 AM Tong Sun wrote: > > > On Tuesday, April 25, 2017 at 4:25:14 PM UTC-4, Tong Sun wrote: >> >> >> On Tue, Apr 25, 2017 at 3:42 P

[go-nuts] Re: Extensible markdown library

2017-04-26 Thread Tong Sun
Take a look at https://github.com/mh-cbon/emd#templates-helper Helped me a lot. On Monday, April 24, 2017 at 12:34:22 PM UTC-4, Achim Domma wrote: > > Hi, > > I'm rather new to Go and for a toy project, I would need to extend > markdown with custom syntax. For example "{key: 123}" should be par

Re: [go-nuts] master to slave communication - design suggestions

2017-04-26 Thread Lutz Horn
> I am working on building a distributed system where a bunch of > workers (can scale to few thousands) are connected to a manager. > Workers send certain local events to the manager and the manager then > should broadcast that event to all other workers. Workers shouldn't > miss any event (for rea

Re: [go-nuts] Expected declaration, found 'package'

2017-04-26 Thread Lutz Horn
> However, the challenge to me is that, it keeps reusing the same > variable name for different purposes (which I think IS good > practice). E.g., For a blog or a tutorial that expands an example, this is fine. But it is bad practice when designing a library. > In one section the type A is define

Re: [go-nuts] Re: Assign a string representation to an enum/const

2017-04-26 Thread Tong Sun
On Tuesday, April 25, 2017 at 4:25:14 PM UTC-4, Tong Sun wrote: > > > On Tue, Apr 25, 2017 at 3:42 PM, Egon wrote: > > I think the extra "enum" package would reduce readability. The code you >> are putting into package is ~10 lines of code... so the extra package >> doesn't reduce much typing,

[go-nuts] Oracle db and panics on interrupt

2017-04-26 Thread pierre . curto
Hello, I am unsure where to log the following issue: whenever I send an interrupt signal to a go process running an Oracle query, it panics with either "fatal: morestack on g0" or "fatal error: runtime: stack split at bad time". A sample code reproducing the issue is here

Re: [go-nuts] master to slave communication - design suggestions

2017-04-26 Thread Ryan Phillips
Hey Manohar, Sounds like this could be simplified by using Kafka as an event bus. Kafka is horizontally scalable and the Sarama golang library is excellent. Regards, Ryan On Wed, Apr 26, 2017 at 11:33 AM, Manohar Kumar wrote: > Hello, > > I am working on building a distributed system where a b

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Sam Whited
On Wed, Apr 26, 2017 at 10:47 AM, Юрий Соколов wrote: > You are not quite right. Sometimes there is scope dependency between Lock > and Unlock, ie Unlock happens not at function exit, but is triggered > asynchronously by some condition. If you can stomach the overhead of yet another stack frame a

[go-nuts] master to slave communication - design suggestions

2017-04-26 Thread Manohar Kumar
Hello, I am working on building a distributed system where a bunch of workers (can scale to few thousands) are connected to a manager. Workers send certain local events to the manager and the manager then should broadcast that event to all other workers. Workers shouldn't miss any event (for re

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Jan Mercl
On Wed, Apr 26, 2017 at 5:47 PM Юрий Соколов wrote: > > Don't Lock without defer Unlock(). (I'm a sinner, just telling what I learned.) > > You are not quite right. Sometimes there is scope dependency between Lock and Unlock, ie Unlock happens not at function exit, but is triggered asynchronously

Re: [go-nuts] Expected declaration, found 'package'

2017-04-26 Thread 'Thomas Bushnell, BSG' via golang-nuts
A single Go source file is not allowed to be in more than one package. On Wed, Apr 26, 2017 at 8:52 AM Tong Sun wrote: > Hi, > > I'm trying to put different code collection into the same Go source file, > (from here > , if > you w

[go-nuts] Expected declaration, found 'package'

2017-04-26 Thread Tong Sun
Hi, I'm trying to put different code collection into the same Go source file, (from here , if you want to know), because the knowledge is related thus better keep in one demo file instead of several. However, the challenge to m

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Юрий Соколов
s/there is scope dependency/there is no scope dependency/ 2017-04-26 18:47 GMT+03:00 Юрий Соколов : > > Don't Lock without defer Unlock(). (I'm a sinner, just telling what I > learned.) > > You are not quite right. Sometimes there is scope dependency between Lock > and Unlock, ie Unlock happens n

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Юрий Соколов
> Don't Lock without defer Unlock(). (I'm a sinner, just telling what I learned.) You are not quite right. Sometimes there is scope dependency between Lock and Unlock, ie Unlock happens not at function exit, but is triggered asynchronously by some condition. More: if you panic cause you already fo

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Jan Mercl
On Wed, Apr 26, 2017 at 11:58 AM roger peppe wrote: > FWIW I have seen real problems in production where long-running worker goroutines stopped working. We looked into it and found that certain rare requests were panicking, not releasing a mutex and thus preventing the long-running goroutine from

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread roger peppe
FWIW I have seen real problems in production where long-running worker goroutines stopped working. We looked into it and found that certain rare requests were panicking, not releasing a mutex and thus preventing the long-running goroutine from acquiring that mutex. This took ages to work out - mad

Re: [go-nuts] bytes.Buffer WriteAt

2017-04-26 Thread Jan Mercl
On Wed, Apr 26, 2017 at 11:21 AM Chris Hopkins wrote: > However I cannot find anyone else having written something similar. FWIW, a [memory] cache with file os.File-like interface: https://github.com/cznic/internal/blob/e5e1c3e9165d0a72507c2bbb0ffac1c02b8d3f7c/file/file.go#L49 A file cache is ju

[go-nuts] Re: bytes.Buffer WriteAt

2017-04-26 Thread Chris Hopkins
Apologies for replying to myself. Digging into the source it looks like I had misunderstood the purpose/functionality of bytes.Buffer. Sorry. Please ignore/delete the question. On Wednesday, 26 April 2017 10:21:10 UTC+1, Chris Hopkins wrote: > > Hi, > Random question: > I'm just starting implemen

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread 'Axel Wagner' via golang-nuts
On Wed, Apr 26, 2017 at 10:55 AM, Peter Herth wrote: > > > On Wed, Apr 26, 2017 at 3:07 AM, Dave Cheney wrote: > >> >> >> On Wednesday, 26 April 2017 10:57:58 UTC+10, Chris G wrote: >>> >>> I think those are all excellent things to do. They do not preclude the >>> use of recovering from a panic

[go-nuts] bytes.Buffer WriteAt

2017-04-26 Thread Chris Hopkins
Hi, Random question: I'm just starting implementing a file cache and using a bytes.Buffer in my testbench as a model of a perfect file. One slight imperfection, the standard bytes.Buffer does not implement WriteAt which I find a little odd as it does implement ReadAt. Now this is easy enough to w

[go-nuts] Re: void type alias can not be understood in cgo

2017-04-26 Thread hui zhang
Is this bug in cgo or in clang for gcc runs well ? CC=clang CGO_ENABLE=1 go build -v void.go -->fail command-line-arguments # command-line-arguments ./void.go:47:10: error: field has incomplete type 'GLvoid' (aka 'void') CC=gcc CGO_ENABLE=1 go build -o void -v void.go -->ok

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Peter Herth
On Wed, Apr 26, 2017 at 3:07 AM, Dave Cheney wrote: > > > On Wednesday, 26 April 2017 10:57:58 UTC+10, Chris G wrote: >> >> I think those are all excellent things to do. They do not preclude the >> use of recovering from a panic to assist (emphasis on assist - it is >> certainly no silver bullet)

[go-nuts] Re: void type alias can not be understood in cgo

2017-04-26 Thread hui zhang
this code runs well on ubuntu gcc --version gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 but build fail on mac gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target

[go-nuts] Re: void type alias can not be understood in cgo

2017-04-26 Thread hui zhang
I simply the case as below , how to fix it? package main /* #include #include typedef void GLvoid; GLvoid Foo() { printf("foo"); } */ import "C" func main() { C.Foo() } go build void.go cgo-gcc-prolog:34:10: error: field has incomplete type 'GLvoid' (aka 'void') 在 2017年4月26日星期三 UTC+8下

Re: [go-nuts] Re: Recover considered harmful

2017-04-26 Thread Henry
The problem with panic is that it hides an alternate execution path. I think it is better to make things explicit and obvious. -- 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

[go-nuts] void type alias can not be understood in cgo

2017-04-26 Thread hui zhang
Check code below go call c opengl/opengles code, typedef void GLvoid func GenVertexArrays(n int32, arrays *uint32) { //C.glGenVertexArrays((C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(arrays))) --> ok on darwin amd64 C.glGenVertexArraysOES((C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(arr