Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread t hepudds
Hi Kamil, FWIW, you probably would be better off going through the official module tutorials: "Tutorial: Get started with Go" -- https://go.dev/doc/tutorial/getting-started.html "Tutorial: Create a Go module" -- https://go.dev/doc/tutorial/create-module Those are listed at the start of the o

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread 'Jakob Borg' via golang-nuts
On 26 Mar 2023, at 20:01, Kamil Ziemian wrote: But I cannot understand why in the blog post we have in go.mod file require rsc.io/quote v1.5.2 so "rsc.io/quote" is considered direct dependency, while go.mod produced by Go 1.20 give me rsc.io/quote

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread Kamil Ziemian
Jan Mercl you right that only TestHello is broken, but it is still broken. As I said, the fact that such simple code in not portable is disturbing. I guess most of the code is tested on OS with English as the main language, at least code for this blog post seems to be, so you can guess what else

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread Jan Mercl
The only broken thing in the code below is the TestHello function. rsc.io/quote uses rsc.io/sampler where the Hello func (https://pkg.go.dev/rsc.io/sampler#Hello) is documented to return a localized string by default. Localized, in the sense of respecting the user's locale. That is not compatible w

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread Kamil Ziemian
Hello, According to the law that any change can break your program/workflow, I want to mention that code shown in "Using Go Modules" https://go.dev/blog/using-go-modules is broken in funny way. Consider code below package hello import "rsc.io/quote" func Hello() string { return quote.Hell

Re: [go-nuts] Various questions about posts from The Go Blog

2023-03-26 Thread Kamil Ziemian
Hello, I try to learn how to use Go modules and Google PhD, recomended me Go blog post "Using Go Modules" https://go.dev/blog/using-go-modules. It seems a bit outdated and I want ask, if it so, should I use other source? I should mention that I like Go blog. Example of things outdated, conside

[go-nuts] Performance of byte-arrays as map keys

2023-03-26 Thread Amit Lavon
Hi gophers, Some code I am writing uses byte-arrays ([X]byte) as keys in a map. I benchmarked the performance of map operations using different X's and found that 4 and 8 are about twice as fast compared to 5, 6, 7 (see below). Can someone explain this phenomenon? I'd like to learn about it so