I think you need to have a main module defined so there must be a go.mod in cwd or upwards in the directory tree, perhaps also with related .go files (not sure).
There are some issues such as this one <https://github.com/golang/go/issues/27233> where usage is confusing due to a lack of a main module. They are marked needs fix and go1.1.2. I think your use case is related. I haven't had a problem with that one because I just set up my workflow to run tests where there are go.mod files. Best, Scott On Thursday, 20 September 2018 21:21:32 UTC+2, John wrote: > > Just started playing with modules recently. Having an issue I don't > understand, wondering if anyone has seen it, the few references to the > error did not provide anything I saw relevant for what I'm doing. > > given a directory structure such as: > > <home>/go/ > src/ > pkg/ > bin/ > > GOPATH NOT SET > GO111MODULE = on > > If the working directory is: > <home>/go/src/ > > go test ./... > > *Results in:* > go: cannot determine module path for source directory /home/jdoak/go/src > (outside GOPATH, no import comments) > > This also occurs if I do: > > go test subdir/subdir/packagedir/... > > But it will work if I do: > > working directory: <home>/go/src/subdir/subdir/packagedir/ > > go test ./... > > I'm sure I'm doing something wrong. If someone could enlighten me. > > -- 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. For more options, visit https://groups.google.com/d/optout.