Go version
go version go1.25.3 darwin/arm64
Output of go env in your module/workspace:
GO111MODULE=''
GOMOD='/Users/dolmen/go/src/github.com/go-chi/chi/toto/go.mod'
GOMODCACHE='/Users/dolmen/go/pkg/mod'
GOPATH='/Users/dolmen/go'
What did you do?
$ go version
go version go1.25.3 darwin/arm64
$ mkdir -p $(go env GOPATH)/src/github.com/go-chi
$ cd $(go env GOPATH)/src/github.com/go-chi
$ LANG=C git clone https://github.com/go-chi/chi.git
Cloning into 'chi'...
remote: Enumerating objects: 3823, done.
remote: Counting objects: 100% (1044/1044), done.
remote: Compressing objects: 100% (346/346), done.
remote: Total 3823 (delta 864), reused 701 (delta 697), pack-reused 2779 (from 4)
Receiving objects: 100% (3823/3823), 3.82 MiB | 14.85 MiB/s, done.
Resolving deltas: 100% (2372/2372), done.
$ cd chi
$ pwd
/Users/dolmen/go/src/github.com/go-chi/chi
$ go list
github.com/go-chi/chi/v5
$ # Note that path in $GOPATH/src doesn't match the module path
$ # github.com/go-chi/chi vs github.com/go-chi/chi/v5
$ go env GO111MODULE
$ go doc | head -1
package chi // import "github.com/go-chi/chi/v5"
$ GO111MODULE=off go doc | head -1
package chi // import "github.com/go-chi/chi"
$ # So far this is fine: doc on stdout respects GO111MODULE
$ go doc -http .
doc: Documentation server listening on addr http://localhost:54952
What did you see happen?
Web browser opens with http://localhost:54952/github.com/go-chi/chi (path matches the path below $GOPATH/src like if GO111MODULE=off)
The same incorrect behaviour happens with go doc -http $(go list) (an explicit package path derived from the Go module) like it happens with . (relative path).
go doc -http should respect GO111MODULE setting (which defaults to on since Go 1.16) to be consistent with go doc.
What did you expect to see?
Web browser opens with Web browser opens with http://localhost:54952/github.com/go-chi/chi/v5 (package path matches go list which is built from the Go module).
Note that go doc -http (without an explicit package path)
Go version
go version go1.25.3 darwin/arm64
Output of
go envin your module/workspace:What did you do?
What did you see happen?
Web browser opens with
http://localhost:54952/github.com/go-chi/chi(path matches the path below$GOPATH/srclike if GO111MODULE=off)The same incorrect behaviour happens with
go doc -http $(go list)(an explicit package path derived from the Go module) like it happens with.(relative path).go doc -httpshould respectGO111MODULEsetting (which defaults toonsince Go 1.16) to be consistent withgo doc.What did you expect to see?
Web browser opens with Web browser opens with
http://localhost:54952/github.com/go-chi/chi/v5(package path matchesgo listwhich is built from the Go module).Note that
go doc -http(without an explicit package path)