[go-nuts] Re: Why we don't have simple throws error statement

2020-08-04 Thread Henry
I disagree with error handling proposals that hide the program flow's branching statements. In 1976, Thomas McCabe found a correlation between branching statements and bugs. His cyclomatic complexity uses program flow to measure code complexity. It is important that branching statements be pla

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Ravi Kant Soni
It's, where trying to run Binary -Linux version 2.6.18 -Red Hat Enterprise Linux Server release 5.11 Jenkins, where Binary generated -RHEL 7.8 -Linux 3.10.0 -- 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] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Kurtis Rader
On Tue, Aug 4, 2020 at 9:31 PM Ravi Kant Soni wrote: > Binary generated in Linux 3.10.0 > > And Running in 2.6.18 > What was the Linux distro and kernel version of the system on which you attempted to run the binary? -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Ravi Kant Soni
Binary generated in Linux 3.10.0 And Running in 2.6.18 -- 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. To view this dis

Re: [go-nuts] "Interfaces" with type lists are a strange beast

2020-08-04 Thread Robert Engels
The operator support is what makes things so complicated. Why not define a “numeric” type that has methods for all the operators that is used with generics, similar to Number in Java. Then it is unified. If you are writing specialized math performant code you would probably use concrete types an

Re: [go-nuts] "Interfaces" with type lists are a strange beast

2020-08-04 Thread Ian Lance Taylor
On Tue, Aug 4, 2020 at 7:31 PM Ben Hoyt wrote: > > > Yes, I think that the ability to write generics using operators is not > > optional. As I've said before, there are some functions that must be > > possible to write using any plausible generics mechanism. One of them > > is the Min function t

Re: [go-nuts] "Interfaces" with type lists are a strange beast

2020-08-04 Thread Ben Hoyt
> Yes, I think that the ability to write generics using operators is not > optional. As I've said before, there are some functions that must be > possible to write using any plausible generics mechanism. One of them > is the Min function that returns the smaller of two values of some > ordered ty

[go-nuts] [dev] ANN: surfsticker

2020-08-04 Thread Lars Lehtonen
Hello, list. I had a goal, which was to use surf as a dedicated browser that lives on the same desktop as my terminal emulator in which I vim. I wanted to have this dedicated browser as a spot to browse godoc on-demand as a result of triggering go-doc-browser in vim-go. I wanted to be sure that s

Re: [go-nuts] "Interfaces" with type lists are a strange beast

2020-08-04 Thread Ian Lance Taylor
On Mon, Aug 3, 2020 at 5:10 PM 'Axel Wagner' via golang-nuts wrote: > > IMO the discussion about this is purely based on the idea of type-lists which > exists purely so as to support operators on type-parameters. And personally I > feel a better way to solve this solution would be to just drop t

Re: [go-nuts] How Go Build and test create file lists needed for compile, build and link when CGO is enabled

2020-08-04 Thread Ian Lance Taylor
On Tue, Aug 4, 2020 at 11:48 AM Mahdi Hosseini wrote: > > I have a problem when trying to run the test for runtime when CGO is enabled. > The test I want to run is CGO_ENABLED=1 go test -run=TestCgoSignalDeadlock > inside src/runtime of the goroot. This test on my machine never compile the c >

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Ian Lance Taylor
On Tue, Aug 4, 2020 at 1:21 PM Ravi Kant Soni wrote: > > runtime: epollwait on fd 4 failed with 38 > Fatal error: runtime : netpoll failed > > runtime stack: > Runtime.throw(0xa59c24, 0x17) >/apps/jenkins/build/tools/go1.12.6.linux-amd64/src/runtime/panic.go:617 > . > > > This generates wh

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Ravi Kant Soni
runtime: epollwait on fd 4 failed with 38 Fatal error: runtime : netpoll failed runtime stack: Runtime.throw(0xa59c24, 0x17) /apps/jenkins/build/tools/go1.12.6.linux-amd64/src/runtime/panic.go:617 . This generates when I run generated binary from jenkins pipeline, in linux box using

Re: [go-nuts] A few thoughts on type parameters

2020-08-04 Thread ben...@gmail.com
> > Which at first seems like a good idea, but then unless "any" is built in >> or this becomes a well-known idiom, it won't be as self-documenting. Other >> people will have to look up the definition to see "oh, I see, this is just >> short-hand for an empty constraint". > > > I'm sure it woul

[go-nuts] How Go Build and test create file lists needed for compile, build and link when CGO is enabled

2020-08-04 Thread Mahdi Hosseini
Hi, I have a problem when trying to run the test for runtime when CGO is enabled. The test I want to run is CGO_ENABLED=1 go test -run=TestCgoSignalDeadlock inside src/runtime of the goroot. This test on my machine never compile the c files and hence led to link problem while my other CGO progr

Re: [go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread Ian Lance Taylor
On Tue, Aug 4, 2020 at 10:38 AM wrote: > > I used 1.12.6 Go library to develop GoLang Application with Beego framework. > When I generate Binary in Linux box and run that binary in same linux box, > its run fine. > > Issue is: when I generate Binary in Jenkins Pipeline, and run that binary in >

Re: [go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread Juliusz Chroboczek
Axel Wagner writes: > I feel like https://go2goplay.golang.org/p/RLn9BXjU1OR is a better > compromise than having two functions. > Prolly. Except OP specifically asked about "not that" :) Agreed on both counts. -- You received this message because you are subscribed to the Google Group

Re: [go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread 'Axel Wagner' via golang-nuts
Prolly. Except OP specifically asked about "not that" :) On Tue, Aug 4, 2020 at 5:30 PM Andrei Tudor Călin wrote: > I feel like https://go2goplay.golang.org/p/RLn9BXjU1OR is a better > compromise than having two functions. > > On Tue, Aug 4, 2020 at 5:50 PM 'Axel Wagner' via golang-nuts < > gola

[go-nuts] Binary generated from jenkins pipeline throwing error in linux box while running - netpoll failed

2020-08-04 Thread nova3ravi
I used 1.12.6 Go library to develop GoLang Application with Beego framework. When I generate Binary in Linux box and run that binary in same linux box, its run fine. Issue is: when I generate Binary in Jenkins Pipeline, and run that binary in Linux box, it gives error, epollwait on fd 4, and n

Re: [go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread Andrei Tudor Călin
I feel like https://go2goplay.golang.org/p/RLn9BXjU1OR is a better compromise than having two functions. On Tue, Aug 4, 2020 at 5:50 PM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > No, that's not possible. A generic function can only work with *either* > built in operato

Re: [go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread 'Axel Wagner' via golang-nuts
No, that's not possible. A generic function can only work with *either* built in operators *or* methods. So, you always need to have two functions: https://go2goplay.golang.org/p/YuzSzDAOEo2 On Tue, Aug 4, 2020 at 4:32 PM Juliusz Chroboczek wrote: > I'd be grateful if people could give me an ex

[go-nuts] How do you write "member" with the proposed generics draft?

2020-08-04 Thread Juliusz Chroboczek
I'd be grateful if people could give me an example to help me understand the generics draft. Suppose I've got these two functions: func MemberInt(x int, a []int) bool { for _, v := range a { if v == x { return true } }

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread peterGo
Martin Møller Skarbiniks Pedersen, Use a RoundUp function for n / d. For example, // n / d rounded up func RoundUp(n, d int64) int64 { if d == 0 { return 0 } return (n + (d - 1)) / d } https://play.golang.org/p/kEMJ04ggkMc Peter On Tuesday, August 4, 2020 at 6:37:06 AM UTC-

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Jesper Louis Andersen
On Tue, Aug 4, 2020 at 12:31 PM Martin Møller Skarbiniks Pedersen < traxpla...@gmail.com> wrote: bet := int64(math.Ceil(float64(cash)/float64(4))) > > Programming languages must make a conscious choice here. Do we make type casts explicit or implicit? Go opted for the explicit approach, probably b

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Michael Jones
var cash, change, bet int64 : bet = cash/4 // change is 0,1,2,3 meaning 0/4, 1/4, 2/4, 3/4 dineros or zlottys or whatever change = cash - 4*bet // or, change = cash%4 // choose one of these if change>0{ bet++ // a: round up means 1/4 and 2/4 and 3/4 go to 1 } // ...or... if change>=2{ bet++ /

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Martin Møller Skarbiniks Pedersen
> > On Sun, Aug 2, 2020 at 2:09 PM Martin Møller Skarbiniks Pedersen < > traxp...@gmail.com > wrote: > >> I have written my first little piece of Go-code. >> However it took some time and code for me to divide a int64 by 4 and >> round down. >> >> [...] >> var bet int64 >> bet = int64(math.Ceil(

Re: [go-nuts] Newbie question about type-casts

2020-08-04 Thread Martin Møller Skarbiniks Pedersen
> > On Sun, Aug 2, 2020 at 2:09 PM Martin Møller Skarbiniks Pedersen < > traxp...@gmail.com > wrote: > >> I have written my first little piece of Go-code. >> However it took some time and code for me to divide a int64 by 4 and >> round down. >> >> How can the last two lines be rewritten? >> >> R

Re: [go-nuts] A few thoughts on type parameters

2020-08-04 Thread Haddock
>> That is an experiment. We don't seem to need the type keyword for >> generic functions. But we do need it for generic types, I'm used for years to look at code with generics in Java. The additional type keyword as proposed for generics in Go in IMHO make reading the declaration containing g