Thanks for the link.

I did try the following:

   - Adding a main.go file and doing a go mod init, but that fails.
   - Just adding a go.mod file with "module main", which allowed 
   compilation, but nothing else worked.
   - And of course, I added GOPATH back, but that didn't help (and I'm 
   pretty sure I saw it was ignored if I turn modules on).
   
I could write workflow to only run tests if go.mod exists.  That seems to 
defeat the whole ./... argument to the tool.  I just was assuming that I've 
made a mistake somewhere in setting this up.  If that is not the case, I 
can certainly modify what I'm doing.  

On Thursday, September 20, 2018 at 2:15:18 PM UTC-7, Scott Cotton wrote:
>
> 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.

Reply via email to