Thanks Jesper and Volker. After reading the article(s) and go help modules and a few blogs, I still was not able to see why deleting go.mod makes the program import jsonstuff package, and compile and run? Modules are a great idea and I want to use them, but I can't get it to compile a "hello golang" program even:
======================= $ ls /home/jfields/go/src/jsonstuff typestuff.go $ go mod init src go: creating new go.mod: module src $ more go.mod module src go 1.14 $ go run main.go main.go:7:2: package jsonstuff is not in GOROOT (/usr/local/go/src/jsonstuff) $ rm go.mod $ go run main.go Hello golang {0} ========================= On Thu, Jul 30, 2020 at 5:01 AM Jesper Louis Andersen < jesper.louis.ander...@gmail.com> wrote: > On Thu, Jul 30, 2020 at 12:54 PM Volker Dobler <dr.volker.dob...@gmail.com> > wrote: > >> You dop not import files and you do >> not run files and you do not test files. Files contain the >> sources but are basically uninteresting: Focus on >> packages (and modules). >> > > In Go, we disconnect the name of a file and the package in which it lives. > That is, the programmer is free (mostly) to choose whatever names for files > in a package, and also free to create as many files as is seen necessary. > It is in contrast to a large set of other languages, which require that the > package and the filename stay the same. The advantage is that you can have > very large packages and gracefully split them over multiple files without > having to resort to inventing new internal package names. > > My general view is that you shouldn't assume a connection between the file > system and the packages of your language, and the languages which do have > the wrong design. However, since that "mistake" is made in many languages, > people tend to get somewhat confused when they encounter a system where it > isn't the case. > > -- > 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/pP-0WEpzbEs/unsubscribe. > To unsubscribe from this group and all its topics, 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/CAGrdgiX%2BN%2BospARM7adQ1E0wk-K7M73Jbj1KEUXkxjGGq9Q9zg%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CAGrdgiX%2BN%2BospARM7adQ1E0wk-K7M73Jbj1KEUXkxjGGq9Q9zg%40mail.gmail.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/CAAcmRO8TZ4ftK%2BFsTQTw7nEGZ0e3gFFpv5uygb4S6YavVRe_Xg%40mail.gmail.com.