Re: [go-nuts] container/heap, heap interface question

2020-04-12 Thread Ian Lance Taylor
On Sun, Apr 12, 2020 at 8:28 PM Ram Kumar wrote: > > Documentation for "container/heap" says > > Package heap provides heap operations for any type that implements > heap.Interface. > > heap.Interface is > > type Interface interface { > sort.Interface > Push(x interface{}) // add x as ele

[go-nuts] container/heap, heap interface question

2020-04-12 Thread Ram Kumar
Documentation for "container/heap" says Package heap provides heap operations for any type that implements heap.Interface. heap.Interface is type Interface interface { sort.Interface Push(x interface{}) // add x as element Len() Pop() interface{} // remove and return element Len(

[go-nuts] Re: Intercepting field access and method call

2020-04-12 Thread Tanmay Das
Very true. On Monday, April 13, 2020 at 1:37:09 AM UTC+6, Amnon Baron Cohen wrote: > > Go is a simple language. > > Code in Go does what it says. No magic. > > That is its beauty. That is its power. > > On Sunday, 12 April 2020 03:59:08 UTC+1, Tanmay Das wrote: >> >> Say you have a struct Foo an

[go-nuts] Re: Is it possible to segment CMD window on Windows and segment Terminal window on Linux with golang?

2020-04-12 Thread 洪嘉鴻
I don't think it is simple to use because it seems to configure lots of settings. However, I'll try this. Thanks for your information! Max Mandolyte於 2020年4月11日星期六 UTC+8下午6時57分25秒寫道: > > Might review how the micro editor handles it... as an editor functioning > in a terminal window and cross pla

[go-nuts] Re: Is it possible to segment CMD window on Windows and segment Terminal window on Linux with golang?

2020-04-12 Thread 洪嘉鴻
I've tried this which you offered, I don't think that it is correct for the box. Besides, I have no idea why "H" disappeared with Linux executable? However, I think I'll try to use this for my tasks. Thanks for your information! Max Jason E. Aten於 2020年4月10日星期五 UTC

[go-nuts] Re: Is it possible to segment CMD window on Windows and segment Terminal window on Linux with golang?

2020-04-12 Thread 洪嘉鴻
I think that you are right. I found that the "Hello World" executables are a little different. In fact, the executables are compiled from the same source code, which means that it might cause a lot of problems if I use it. I'll try to create a web browser. Thanks for your suggestions! Max Jason E

Re: [go-nuts] testing code that uses ioutil.ReadDir?

2020-04-12 Thread Rob Pike
I am the author of the test coverage tool, and I do not believe that 100% code coverage is the right goal. Coverage is a proxy for testing quality, but not a guarantee of it. Getting to 100% coverage is a better indicator of chasing metrics than of actually writing good tests. I'm happy if my cover

[go-nuts] Re: Intercepting field access and method call

2020-04-12 Thread Amnon Baron Cohen
Go is a simple language. Code in Go does what it says. No magic. That is its beauty. That is its power. On Sunday, 12 April 2020 03:59:08 UTC+1, Tanmay Das wrote: > > Say you have a struct Foo and you access fields and call methods on it as > you normally would. But is it possible to execute

Re: [go-nuts] Intercepting field access and method call

2020-04-12 Thread robert engels
You probably want to use interfaces. You can do a lot of “seemingly dynamic” programming with interfaces. There are statically typed languages that pretty dynamic - Java with reflection and proxies - but Go is also statically compiled which makes the options limited - which is usually a good th

Re: [go-nuts] Intercepting field access and method call

2020-04-12 Thread Tanmay Das
Hi Jake, Thanks for the wishes. BTW, this is not my first statically typed language, I know a little bit of C and Java. I was under the impression that Go is capable of some dynamic behavior. Maybe things like Go's type inference, duck typing, empty interface{} led me to believe that. All these

Re: [go-nuts] Intercepting field access and method call

2020-04-12 Thread Brian Candler
And just to add, since you mentioned fields on a struct: all fields are initialized to their "zero value" (which for example is 0 for an int, or empty string for a string). So there is no such thing as a non-existent or uninitialized field. -- You received this message because you are subscri

Re: [go-nuts] Intercepting field access and method call

2020-04-12 Thread Jake Montgomery
It sounds like maybe this is your first statically typed language. Go is statically typed, which means that the scenarios you are talking about can not happen. That is by design, and has huge benefits for code reliability, and also readability. If you call a function that takes a Foo struct as a

Re: [go-nuts] Intercepting field access and method call

2020-04-12 Thread Nedim Sabic
Hi, You could achieve function / method interception with ebpf and uprobes. You can find a thorough tutorial here: https://sematext.com/blog/ebpf-userland-apps/ El dom., 12 abr. 2020 6:20, Tanmay Das escribió: > Hi, thanks for your reply. I am still in the learning phase and when I > learn the

[go-nuts] testing code that uses ioutil.ReadDir?

2020-04-12 Thread Kevin Malachowski
Is there a particular reason you want 100% code coverage? Not trying to start a flame war: given limited time and effort, unless the rest of my projects had 100% coverage already, I would personally spend my time working with a package with lower coverage, or just fixing known bugs. If your cod

[go-nuts] Re: Tools for managing licenses of dependencies

2020-04-12 Thread Davor Kapša
Maybe this can help: https://github.com/mitchellh/golicense D On Saturday, April 11, 2020 at 10:03:18 PM UTC+2, Victor Denisov wrote: > > Hi, > > Are there any tools that would allow to manage licenses of my go modules? > I would like to be able to specify what licenses of my dependencies are >

[go-nuts] Re: modules and indirect

2020-04-12 Thread Jérôme LAFORGE
Hello, in addition to my previous message, this how to reproduce this problem with mogodb driver (as go-kit has errors while updating its modules with go get -u ./...): $ git clone https://github.com/mongodb/mongo-go-driver.git $ git checkout 6d539cd5b1ab1700e04cb39f134a408c39b7d2d5 $ go get -u