"Technically that behaviour is still available via GO111MODULE=auto.
Go 1.16 changed the default from "auto" to "on"."

Thank you for that information. It is surprisingly hard to me to learn 
basic of Go and Go tools, when things don't works as described.

I found few another places where "Using Go Modules" 
(https://go.dev/blog/using-go-modules) is not up to date with out of box Go 
version 1.17.2.

1) According to part "Adding a dependency" (end of fourth block of text) 
"Only direct dependencies are recorded in the go.mod file". But my go.mod 
file contains lines.

require (
    golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c // indirect
    rsc.io/sampler v1.3.0 // indirect
)

2) After using "go get golang.org/x/text" command "go list -m all" I get 
one line more that in blog post

golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e

3) After function TestProverb(t *testing.T) is and running "go test" (I'm 
quite sure that when I did this few years ago, this was the command that I 
used) I get

hello.go:5:2: no required module provides package rsc.io/quote/v3; to add 
it:
    go get rsc.io/quote/v3

This is easy to solve by running "go get rsc.io/quote/v3", but still 
annoying when you are going through this post.

Best
Kamil
niedziela, 31 października 2021 o 00:29:57 UTC+2 Kamil Ziemian napisał(a):

> This is probably silly thing, but I will write it down just in case.
>
> I mentioned before Go blog post "Using Go Modules" (
> https://go.dev/blog/using-go-modules), we first write a function
>
> func Hello() string {
>     return "Hello, world."
> }
>
> and test for it which basically check condition
>
> Hello() == "Hello, world."
>
> In the next step we change our function to
>
> func Hello() string {
>     return quote.Hello()
> }
>
> using the module "rsc.io/quote". But this is "not portable example" and 
> when test on my computer PASS when using the first version of our Hello() 
> function, it FAILS with the second.
>
> According to description quote.Hello() (
> https://pkg.go.dev/rsc.io/quote#Hello), but from source code we know that 
> in fact it returns a string returned by sampler.Hello(prefs 
> ...language.Tag). The last function "returns a localized greeting. If no 
> prefs are given, Hello uses DefaultUserPrefs." (
> https://pkg.go.dev/rsc.io/sampler#Hello).
>
> On my computer it correctly detected polish language so quote.Hello() 
> returns "Witaj świecie." and since "Witaj świecie." != "Hello, world." the 
> test now fails.
>
> Best
> Kamil
>
> sob., 30 paź 2021 o 23:28 Sean Liao <seank...@gmail.com> napisał(a):
>
>> Technically that behaviour is still available via GO111MODULE=auto.
>> Go 1.16 changed the default from "auto" to "on".
>>
>> On Saturday, October 30, 2021 at 11:17:05 PM UTC+2 kziem...@gmail.com 
>> wrote:
>>
>>> Hello,
>>>
>>> I don't have energy today to read Go language spec or learning how UTF-8 
>>> works, so I decided to make a look at Go blog post "Using Go Modules" (
>>> https://go.dev/blog/using-go-modules). I have a simple question: is 
>>> this post up to date?
>>>
>>> I guess not, here is my reason why. According to it if I run command "go 
>>> test" outside $GOPATH and in director without go.mod file I should get 
>>> result similar to
>>>
>>> PASS
>>> ok      _/some path/hello 0.020s
>>>
>>> When I run it with my go version go1.17.1 linux/amd64, result is
>>>
>>> go: go.mod file not found in current directory or any parent directory; 
>>> see 'go help modules'
>>>
>>> This is one of the Go blog post listed on Documentation page (
>>> https://golang.org/doc/), so I guess it should have note "If you use Go 
>>> in version x.y.z or latter, some code may not work", but maybe I just think 
>>> about it in the wrong way.
>>>
>>> From practical reason this particular thing isn't important, because 
>>> go.mod file is the way to go (or at least this is what I read in the last 
>>> week).
>>>
>>> Best
>>> Kamil
>>>
>>> wtorek, 7 września 2021 o 22:23:19 UTC+2 Ian Lance Taylor napisał(a):
>>>
>>>> On Tue, Sep 7, 2021 at 3:40 AM Kamil Ziemian <kziem...@gmail.com> 
>>>> wrote: 
>>>> > 
>>>> > In the post "Concurrency is not parallelism" by Andrew Gerrand (
>>>> https://go.dev/blog/waza-talk) under the paragraph starting with "To 
>>>> clear up this conflation, Rob Pike gave a talk at Heroku’s Waza" in my 
>>>> browser is big blank space. I believe that that I can see rectangle in it, 
>>>> with slightly different hue of with, but I can't be sure. 
>>>> > 
>>>> > Is it my browser not working or something goes wrong with the page? 
>>>> Can someone check if he/she has the same problem? I use Mozilla Firefox 
>>>> for 
>>>> Ubuntu canonical - 1.0, version 91.0.2 (64 bits). I hope I don't mess up 
>>>> Fierfox data. 
>>>>
>>>> Thanks, sent https://golang.org/cl/348013 to fix this. 
>>>>
>>>> Ian 
>>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/golang-nuts/p4YTbDqTUhI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/fce2cfcc-993d-4c25-8863-484b67b02870n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/fce2cfcc-993d-4c25-8863-484b67b02870n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1e314622-6ab3-4c85-9834-6251c7d5aa88n%40googlegroups.com.

Reply via email to