[go-nuts] Re: Is it possible to intercept runtime futex function call?

2020-08-05 Thread Brian Candler
Do you want to intercept all syscalls, from both the main program and the loaded library? Maybe running under a modified gvisor would do it. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

[go-nuts] Re: How to fast transpose byte matrix [][]byte in Golang assembly

2020-08-05 Thread peterGo
jake, I do the same thing but I like to have the correct length and capacity. func NewMatrix(r, c int) [][]int { a := make([]int, r*c) m := make([][]int, r) lo, hi := 0, c for i := range m { m[i] = a[lo:hi:hi] lo, hi = hi, hi+c } return m } https://play.go

Re: [go-nuts] Is it possible to intercept runtime futex function call?

2020-08-05 Thread Yosef Yo
Thank you for your reply. What I meant was actually dynamically loading a C-shared library written in go (buildmode=c-shared). On Thursday, August 6, 2020 at 12:19:29 PM UTC+9 Kurtis Rader wrote: > On Wed, Aug 5, 2020 at 8:02 PM Yosef Yo wrote: > >> In go/src/runtime/os/linux.go, function fute

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

2020-08-05 Thread Robert Engels
I understand your point, but I think a few minor corrections Make a difference - it does not matter that String supports + and not - , a string would not be a Number. String concatenation is not addition. There are also several ways to implement “ordering” with complex numbers, even between co

Re: [go-nuts] Is it possible to intercept runtime futex function call?

2020-08-05 Thread Kurtis Rader
On Wed, Aug 5, 2020 at 8:02 PM Yosef Yo wrote: > In go/src/runtime/os/linux.go, function futexsleep is defined as to call > futex function of linux. runtime. futex is implemented in syscall assembly > instruction. I am currently dynamically loading a golang c-shared library > as a plugin, and I w

[go-nuts] Re: First git commit for Go was in 1972? 🤯

2020-08-05 Thread Henry
It is that darn time machine I am telling you. They have had it for years but they just keep it hidden from the rest of us. On Wednesday, August 5, 2020 at 4:17:42 PM UTC+7, Amarjeet Anand wrote: > > How come the first git commit for Go was in 1972? > > Anybody want to share the story behind the

Re: [go-nuts] Is it possible to intercept runtime futex function call?

2020-08-05 Thread Ian Lance Taylor
On Wed, Aug 5, 2020 at 8:01 PM Yosef Yo wrote: > > In go/src/runtime/os/linux.go, function futexsleep is defined as to call > futex function of linux. runtime. futex is implemented in syscall assembly > instruction. I am currently dynamically loading a golang c-shared library as > a plugin, and

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

2020-08-05 Thread Ian Lance Taylor
On Wed, Aug 5, 2020 at 6:28 PM Robert Engels wrote: > > True, but cant Comparable be implemented by all built types? And Number be > implemented by numeric types? Sure, you can’t use the operators in generic > code but given most generic code is collections based it seems not a big loss. The mo

[go-nuts] Is it possible to intercept runtime futex function call?

2020-08-05 Thread Yosef Yo
In go/src/runtime/os/linux.go, function futexsleep is defined as to call futex function of linux. runtime. futex is implemented in syscall assembly instruction. I am currently dynamically loading a golang c-shared library as a plugin, and I wanted to intercept the futex syscall and use my own i

[go-nuts] Re: How to fast transpose byte matrix [][]byte in Golang assembly

2020-08-05 Thread jake...@gmail.com
Not a direct answer, but one simple improvement you could do is to allocate all the rows together, then break them up by slicing. So instead of your: T := make([][]byte, n) for i := 0; i < n; i++ { T[i] = make([]byte, m) } Do something like: T := make([][]byte, n) Q

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

2020-08-05 Thread Robert Engels
True, but cant Comparable be implemented by all built types? And Number be implemented by numeric types? Sure, you can’t use the operators in generic code but given most generic code is collections based it seems not a big loss. > On Aug 5, 2020, at 4:30 PM, Ian Lance Taylor wrote: > > On Tu

Re: [go-nuts] First git commit for Go was in 1972? 🤯

2020-08-05 Thread David Riley
> On Aug 5, 2020, at 5:16 AM, Amarjeet Anand > wrote: > > How come the first git commit for Go was in 1972? > > Anybody want to share the story behind the first 4 commits of Go project by > Brian Kernighan? > > > https://github.com/golang/go/commits/master?after=188b2ac839f828254678d0f05a3

Re: [go-nuts] How to read (and write) the ECN bits?

2020-08-05 Thread Andrei Tudor Călin
ECN bits are represented in the TOS field. I think you can use setsockopt with the IP_TOS option to set the TOS field on a socket. See ip(7). On the Go side, use the SyscallConn method on your UDPConn, then call setsockopt using the Control method. Something like this (untested): https://play.golan

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

2020-08-05 Thread Ian Lance Taylor
On Tue, Aug 4, 2020 at 9:19 PM Robert Engels wrote: > > 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 > specialize

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

2020-08-05 Thread Ian Lance Taylor
On Wed, Aug 5, 2020 at 5:50 AM Andrei Tudor Călin wrote: > > Go requires Linux 2.6.23 or later. Yes, and more generally RHEL 5 is not supported and known to fail. This is mentioned at https://golang.org/doc/install . Sorry. But note that as far as I know RHEL 5 is end-of-life in a few months.

[go-nuts] How to read (and write) the ECN bits?

2020-08-05 Thread martenseemann
I'm working on a Go implementation of the QUIC protocol ( https://github.com/lucas-clemente/quic-go). QUIC specifies how to use ECN (Explicit Congestion Notification) to detect and respond to congestion in the network (see https://tools.ietf.org/html/draft-ietf-quic-transport-29#section-13.4 for

[go-nuts] How to fast transpose byte matrix [][]byte in Golang assembly

2020-08-05 Thread Wei Shen
Hi all, Matrix transpose in pure golang is slow in HPC cases, and using package gonum needs structure transformation which costs extra time. So a assembly version may be a better solution. Sizes of the matrix vary ([][]byte) or can be fixed for example ( [64][512]byte), and the element type m

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

2020-08-05 Thread jimmy frasche
Most of the code I'd write with generics would take a func or something satisfying an interface to set the operations if necessary. I'd use type lists as a handy way for the user to default those to operators. Interface literals and lambdas would be just as useful here. I probably wouldn't bother w

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

2020-08-05 Thread Jan Mercl
On Wed, Aug 5, 2020, 19:39 Tyler Compton wrote: > On Wed, Aug 5, 2020 at 1:07 AM Jan Mercl <0xj...@gmail.com> wrote: > >> It's not supposed to be anything special whatsoever. Just like number >> zero or an empty set is not some kind of an exception. It's just you >> cannot have any reasonable set

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

2020-08-05 Thread Tyler Compton
On Wed, Aug 5, 2020 at 1:07 AM Jan Mercl <0xj...@gmail.com> wrote: > It's not supposed to be anything special whatsoever. Just like number > zero or an empty set is not some kind of an exception. It's just you > cannot have any reasonable set theory without it. > I think it's fair to say that `in

Re: [go-nuts] First git commit for Go was in 1972? 🤯

2020-08-05 Thread Alexander Mills
git didnt exist until 2009 or something lol On Wed, Aug 5, 2020 at 3:36 AM Mohamed Yousif wrote: > > I did small google search and here are the findings > > >Brian Kernighan actually wrote the first "hello, world" program as part of > >the documentation for the BCPL programming language. BCPL wa

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

2020-08-05 Thread Denis Cheremisov
> I think "[type T]" is slightly clearer than "[T any]". Code with `[T any]` is much easier to read at least for me. среда, 5 августа 2020 г. в 11:07:59 UTC+3, Jan Mercl: > On Tue, Aug 4, 2020 at 6:07 AM 'Carla Pfaff' via golang-nuts > wrote: > > > On Tuesday, 4 August 2020 at 00:34:12 UTC+2

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

2020-08-05 Thread Andrei Tudor Călin
Go requires Linux 2.6.23 or later. On Wed, Aug 5, 2020 at 7:47 AM Ravi Kant Soni wrote: > 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 me

Re: [go-nuts] First git commit for Go was in 1972? 🤯

2020-08-05 Thread Mohamed Yousif
I did small google search and here are the findings >Brian Kernighan actually wrote the first "hello, world" program as part of the documentation for the BCPL programming language. BCPL was used while C was being developed at Bell Labs a few years before the publication of Kernighan and Ritchie's

[go-nuts] First git commit for Go was in 1972? 🤯

2020-08-05 Thread Amarjeet Anand
How come the first git commit for Go was in 1972? Anybody want to share the story behind the first 4 commits of Go project by Brian Kernighan? https://github.com/golang/go/commits/master?after=188b2ac839f828254678d0f05a3ea953dc5d0621+4764&branch=master -- You received this message because y

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

2020-08-05 Thread Jan Mercl
On Tue, Aug 4, 2020 at 6:07 AM 'Carla Pfaff' via golang-nuts wrote: > On Tuesday, 4 August 2020 at 00:34:12 UTC+2 ben...@gmail.com wrote: > I'm sure it would quickly become a well-known idiom, just like people know > that "error" is "interface{Error() string}" or "fmt.Stringer" is > "interface