Repository: go
Issue: cmd/go: go clean does not remove .exe file for main built by "go build sub/pkg"
Labels: Documentation,NeedsInvestigation

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.18.2 windows/amd64
</pre>

### Does this issue reproduce with the latest release?
yes


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
λ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Plastikfan\AppData\Local\go-build
set GOENV=C:\Users\Plastikfan\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Plastikfan\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Plastikfan\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\Plastikfan\dev\github\go\snivilised\squif\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\PLASTI~1\AppData\Local\Temp\go-build1040139346=/tmp/go-build -gno-record-gcc-switches
</pre></details>

### What did you do?
A module with a main package in a sub package at ./src/app.

`foo` module structure
```
/foo
│   go.mod
│
└───src
    └───app
            main.go
```

go.mod:

```go
module github.com/plastikfan/bar

go 1.18
```

main.go:

```go
package main

import "fmt"

func main() {
	fmt.Printf("hello")
}
```

> go build ./src/app

This should create app.exe at the root:

```
/foo
│   app.exe
│   go.mod
│
└───src
    └───app
            main.go
```

Then run
> go clean

Nothing happens

Use the -n option:
> go clean -n

```
go clean -n
cd C:\Users\Plastikfan\dev\go\foo
rm -f foo.test foo.test.exe ..test ..test.exe
```

So where is app.exe in this list? Why does this not work for a sub-package?

If this is by design, then what is the correct way of doing the clean for sub-packages.

Referring to the go docs at [go clean](https://pkg.go.dev/cmd/go#hdr-Remove_object_files_and_cached_files), does not shed any light on this issue.

The following additional options have been tried:
+ -i: ___"The -i flag causes clean to remove the corresponding installed archive or binary (what 'go install' would create)."___
+ -r: ___"The -r flag causes clean to be applied recursively to all the dependencies of the packages named by the import paths."___

... has no effect

The other options ___modcache___, ___cache___ and ___testcache___ all seem like nuclear options

Googling around for this has served up no effective solution, so raising this issue is my last resort.

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->



### What did you expect to see?
Built exe file to be deleted


### What did you see instead?
already explained above