[go-nuts] Taking single value from multi-return function and inlining function calls

2022-08-29 Thread Tanmay Das
Hi, I am relatively new to the Go language, and I have always wanted to ask this question: Consider the following snippet: package main import "fmt" func returnMany() (int, int) { return 4, 2 } func useOne(value int) { fmt.Println(value) } func main() { useOne(returnMany()) } T

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

2020-04-13 Thread Tanmay Das
Thanks for the clarification, Brian! On Monday, April 13, 2020 at 2:56:49 PM UTC+6, Brian Candler wrote: > > On Sunday, 12 April 2020 18:12:16 UTC+1, Tanmay Das wrote: >> >> this is not my first statically typed language, I know a little bit of C >> and Java. I was unde

[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: >>

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-11 Thread Tanmay Das
ow I know that it's not allowed. On Sunday, April 12, 2020 at 9:13:03 AM UTC+6, Kurtis Rader wrote: > > On Sat, Apr 11, 2020 at 7:59 PM 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

[go-nuts] Intercepting field access and method call

2020-04-11 Thread Tanmay Das
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 a hook before or after that field access or method call? A good scenario will be: The user calls non-existent method foo.Bar() or accesses non-existent field foo.Bar. If t

[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
Thanks, everyone for your valuable comments. I think Brain is right. It might be an OS-related issue. I really like how active this group is. I look forward to coming back with more topics in the future. Stay Home. Stay Safe. On Wednesday, April 8, 2020 at 10:17:36 PM UTC+6, Tanmay Das wrote

[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
It does. On Thursday, April 9, 2020 at 5:11:04 PM UTC+6, Brian Candler wrote: > > On Thursday, 9 April 2020 12:01:31 UTC+1, Tanmay Das wrote: >> >> Running the executable: `./helloworld` >> >> > OK, then clearly it's not an issue with finding our downloading

[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
ven though your program doesn't have one, you might wanna try running the program later.* The cursor just stuck in the terminal for eternity. I had to quit it with Ctrl + C. On Thursday, April 9, 2020 at 4:15:50 PM UTC+6, Brian Candler wrote: > > On Thursday, 9 April 2020 06:15:22 UTC+1

[go-nuts] Re: go run requires internet connection?

2020-04-09 Thread Tanmay Das
Hmm, it makes sense. Still, there should be some caching mechanism. If the internet connection can't be established, load the dep from the cache. On Thursday, April 9, 2020 at 1:14:33 PM UTC+6, Volker Dobler wrote: > > On Wednesday, 8 April 2020 18:17:36 UTC+2, Tanmay Das wrote: &g

[go-nuts] Re: go run requires internet connection?

2020-04-08 Thread Tanmay Das
No. OS X 10.15.3 On Thursday, April 9, 2020 at 11:40:51 AM UTC+6, Tamás Gulácsi wrote: > > Is it in Windows? Any antivirus may be involved? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] Re: go run requires internet connection?

2020-04-08 Thread Tanmay Das
I also forgot to mention one thing. I was able to build the program using go build. Even the executable was there. It just didn't run until I connected to internet. On Wednesday, April 8, 2020 at 10:17:36 PM UTC+6, Tanmay Das wrote: > > Hey Gophers, > My very first post here. >

Re: [go-nuts] go run requires internet connection?

2020-04-08 Thread Tanmay Das
It's a simple hello world program that doesn't require any go-gettable package: package main import ( "fmt" ) func main() { fmt.Println("Hello World") } On Wednesday, April 8, 2020 at 10:30:31 PM UTC+6, Marvin Renich wrote: > > * Tanmay Das > [200408

[go-nuts] go run requires internet connection?

2020-04-08 Thread Tanmay Das
Hey Gophers, My very first post here. Today I faced an unexpected power outage and I wanted to tinker with Go a little bit. I wrote a simple hello world program and ran go run helloworld.go Strangely the code didn't run. In fact, the terminal prompt never exited. I kept running the same comman