continue
                }
 
+               // If there were no arguments, CleanPatterns returns ".". Set the raw
+               // string back to "" for better errors.
+               if len(rawArgs) == 0 {
+                       q.raw = ""
+               }
+
                // Guard against 'go get x.go', a common mistake.
                // Note that package and module paths may end with '.go', so only print an error
                // if the argument has no version and either has no slash or refers to an existing file.
                        }
 
                        if len(match.Pkgs) == 0 {
+                               if q.raw == "" || q.raw == "." {
+                                       return errSet(fmt.Errorf("no package in current directory"))
+                               }
                                if !q.isWildcard() {
                                        return errSet(fmt.Errorf("%s%s is not a package in module rooted at %s", q.pattern, absDetail, modload.ModRoot()))
                                }
 
                }
        }
 
-       base.Errorf("go get %s: %s", q, errStr)
+       if qs := q.String(); qs != "" {
+               base.Errorf("go get %s: %s", qs, errStr)
+       } else {
+               base.Errorf("go get: %s", errStr)
+       }
 }
 
 func reportConflict(pq *query, m module.Version, conflict versionReason) {
 
 # in an empty directory should refer to the path '.' and should not attempt
 # to resolve an external module.
 cd dir
+! go get
+stderr '^go get: no package in current directory$'
 ! go get .
-stderr 'go get: \. \(.*[/\\]dir\) is not a package in module rooted at .*[/\\]dir$'
+stderr '^go get \.: no package in current directory$'
+! go get ./subdir
+stderr '^go get: \.[/\\]subdir \('$WORK'[/\\]gopath[/\\]src[/\\]dir[/\\]subdir\) is not a package in module rooted at '$WORK'[/\\]gopath[/\\]src[/\\]dir$'
 ! go list
 ! stderr 'cannot find module providing package'
 stderr '^no Go files in '$WORK'[/\\]gopath[/\\]src[/\\]dir$'