Re: [go-nuts] Interface method return other interface?

2019-10-10 Thread Martin Palma
Thank you all for your feedback and input. Shame on me that I didn't look hard enough through the stdlib for getting some examples, but thanks Axel for pointing that out. On Thu, Oct 10, 2019 at 3:11 AM Robert Engels wrote: > > Ugh. Every time I see that I cringe > > > On Oct 9, 2019, at

Re: [go-nuts] go module & local package

2019-10-10 Thread Henry
Thanks for the reply. It's been helpful. It appears that godoc does not work with go module? Somehow my godoc only documents those packages in my gopath. On Wednesday, October 9, 2019 at 1:07:06 PM UTC+7, Dimas Prawira wrote: > > Let me define this first modules are collections of packages. In

[go-nuts] Re: About package lxn/walk

2019-10-10 Thread HaWe
Don't know about the lnx package. And I didn't check your code. But I can answer beginner's questions: 1. The plus sign means concatenation for strings. var s = "text" s += "\n" 2. fmt.Println prints to standard output, but fmt.Sprintln prints to a string. 3. Similar answer: Use

[go-nuts] [ANN] go-resty v2.1.0 released - Simple HTTP and REST client library

2019-10-10 Thread Jeevanandam M.
Hello All - Stable Version : github.com/go-resty/resty/v2 Release Notes : https://github.com/go-resty/resty/releases/tag/v2.1.0 Cheers, Jeeva -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] How to print arrays with commas and brackets

2019-10-10 Thread Michele Caci
Hello Nalin, If you use a slice of strings to hold your data, as an alternative you could go with fmt.Printf("[%s]", strings.Join(your_slice_of_strings, ",")) Cheers! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Go Lang Challenge

2019-10-10 Thread ckcharmingchandan
Part- 1 Implement your own versions of the following data structures in non-parallel and parallel execution formats, and compare them. Stack (Linked List, Array based and Binary Tree) Circular Buffer (Linked List, Array based and Binary Tree) As part of your comparison you will need to

[go-nuts] Re: About package lxn/walk

2019-10-10 Thread Jake Montgomery
Welcome Max, First a tip. It is easier for people to view your code samples if you post them in the playground . Even though this code will not run in the playground, due to the imports, its a nice way for people to quickly see what you are talking about. The code

Re: [go-nuts] why not heap.Pop return nil while h.Len is 0?

2019-10-10 Thread 陈清和
well, i know...very appreciate for your explaination, thank you very much. 在 2019年10月11日星期五 UTC+8下午12:41:55,Kurtis Rader写道: > > Note that other languages, such as Python, have the same behavior as Go > for the reason mentioned by Ian. If you call Pop() on an empty > interface/list/etc., and it

Re: [go-nuts] why not heap.Pop return nil while h.Len is 0?

2019-10-10 Thread Ian Lance Taylor
On Thu, Oct 10, 2019 at 9:14 PM 陈清和 wrote: > > src/container/heap/heap.go: > > ```go > func Pop(h Interface) interface{} { > n := h.Len() - 1 > h.Swap(0, n) > down(h, 0, n) > return h.Pop() > } > ``` > > While the h is empty, also the h.Len() equals to 0,why not return nil in > advance? In the

[go-nuts] why not heap.Pop return nil while h.Len is 0?

2019-10-10 Thread 陈清和
src/container/heap/heap.go: ```go func Pop(h Interface) interface{} { n := h.Len() - 1 h.Swap(0, n) down(h, 0, n) return h.Pop() } ``` While the h is empty, also the h.Len() equals to 0,why not return nil in advance? In the current way, we have to do boundary check in implement of Swap,

Re: [go-nuts] why not heap.Pop return nil while h.Len is 0?

2019-10-10 Thread Kurtis Rader
Note that other languages, such as Python, have the same behavior as Go for the reason mentioned by Ian. If you call Pop() on an empty interface/list/etc., and it returns a distinct value for that condition, you still have to check that the pop failed. It is better to require the caller to do the