Hello Stuart, I haven't digested everything here, but one comment is that all of the directives in go.mod like 'require' and 'replace' all deal with module paths, and not package import paths.
This 'replace' I think does nothing: replace github.com/mygit/webserverbase/config v0.1.0-alpha => ../config because it is using a package import path and not a module path. The module path was defined in the other go.mod on the 'module' line as: module github.com/mygit/webserverbase Backing up, I suspect part of what is tripping you up is the exact relationship between repositories vs. modules vs. packages vs. import paths. Here is a summary of the relationships between those concepts which might help: * A _repository_ contains one or more Go _modules_ (usually exactly one module in the repository root). * Each module contains one or more Go _packages_. * Each package consists of one or more Go _source files_ that all reside in a _single directory_. * Go source code: * declares its own package with a `package foo` statement. * automatically has access to other Go source code in the same package. * imports code from another package via an _import path_ supplied in an import statement such as `import "github.com/some/repo/pkg1"`. The import path always starts with the module path of that package, regardless of whether that package is in the same module or a different module. Also, I would like to repeat the advice that someone gave you earlier that it is best to avoid >1 module in a repo if you can, especially when starting out with modules, which sounds like the case here if I followed. The most common and easiest approach is a single go.mod per repository, with the single go.mod file placed in the repository root, and using the repository name as the module path declared in the module line in the go.mod. That avoids multiple subtleties... One alternative you could consider is using a leading underscore for your examples directory, as shown for example here: https://github.com/loov/hrtime/tree/master/_example >From the go documentation: > Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata". Regards, thepudds On Tuesday, October 22, 2019 at 10:01:24 AM UTC-4, Stuart Davies wrote: > > Cannot make local changes. Dispite previous comments This is still a > frustrating issue! > > I have the following project structure: > ── webserverbase > ├── config > │ ├── config.go > ├── example > │ ├── go.mod // Mod file 1 > │ ├── go.sum > │ ├── webserver.go > ├── exec > │ ├── exec.go > │ └── exec_test.go > ├── go.mod // Mod file 2 > ├── go.sum > > Mod File 1: > module webserver.go > go 1.13 > require github.com/mygit/webserverbase v0.1.0-alpha // indirect > replace github.com/mygit/webserverbase/config v0.1.0-alpha => > ../config > > Mod File 2: > module github.com/mygit/webserverbase > go 1.13 > > At $GOPATH/pkg \mod\github.com\mygit\web!server!base@v0.1.0-alpha\ The > whole project source branch > > In the examples dir I can: > go install webserver.go > I get an exe in: > C:\Users\user\go\bin > > If I change webserverbase\config\config.go NOTHING CHANGES! Dispite the > replace in the go.mod file. > > I need to make local changes to config before pushing to git. What am I > dooing wrong! > > I even introduced a syntax error in to config.go. It is IGNORED! > > Please Please help. I cannot see where I am going wrong! It should not be > this hard! > > Stuart > > On Monday, 23 September 2019 16:25:30 UTC+1, Stuart Davies wrote: >> >> Hi. >> >> >> I have been using GO for about a year and I love the language and ideas >> behind the language. I am also a Java developer for many years, I switched >> from Delphi to Java 1, the new and exciting language from Sun (a bit like >> GO is now from Google). >> >> >> >> In Java we have Maven and Gradle (sorry Ant) to make dependency hell more >> manageable so I understand the need for modules in Go. I have just >> installed GO 1.13 and thought I would convert an existing 'pet' project to >> use modules. It did NOT go well! >> >> >> >> What I need is a dummies guide to the GO module so I can build good, >> reliable, standards compliant GO applications. >> >> >> >> I needs to explain the new terminology in the context of a module, like >> 'vendor'. Not just a one liner, I NEED to understand! >> >> >> >> I know how to use Google but the quality of the articles I have read on >> this subject is minimal and just brushes the surface. >> >> >> >> If I have a reasonably large and complex (pet) project with local >> packages in it. I like to split my project in to small units with >> 'namespaces' to keep it manageable. These are NOT reusable components until >> I decide they qualify and publish on Github. >> >> - Why MUST I import them as if they are from github and then >> 'replace' them, and if I don’t 'MUST' then you have failed to explain >> this >> feature to me! >> - My local packages are part of my application. They are, I agree >> still 'dependencies' but they are not 'DEPENDENCIES' that I need (or even >> want) to import from a repository. They are part of my project. >> - What if I do not want to host my project on a GIT repo (Shock >> horror!). >> - Why do all imports start with github.com. Is that a requirement, >> what is the rational for this. >> - How does a 'import' resolve its 'reference'. >> - Should I add the go.mod and go.sum files to my repository or should >> the developer who cloned my project have to do a go mod init (bummer!). >> >> *Can someone please explain, properly!* >> >> We must have Modules and Repositories (like Maven Central) for the >> 'Enterprise' to manage dependencies but what about 'keep it simple' for the >> rest of us (and for that matter more mature enterprise developers like >> myself). >> >> >> >> Please help me get this understood. This is the sort of thing that can >> raise a language above the rest and I would really like that to happen. Go >> is brilliant… >> >> >> >> Regards >> >> >> >> Stuart >> > -- 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/465f8b03-fa88-483e-964b-7cb05c4df827%40googlegroups.com.