Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: cmd line tool panics with panic: http: multiple registrations for <pwd> #53323

Closed
pallavagarwal07 opened this issue Jun 10, 2022 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Milestone

Comments

@pallavagarwal07
Copy link

pallavagarwal07 commented Jun 10, 2022

What is the URL of the page with the issue?

N/A

Issue is with the command line tool pkgsite

What is your user agent?

N/A

Screenshot

Error screenshot

What did you do?

Since we use generics, and godocs is deprecated, we tried generating Go docs for our private repo using pkgsite instead. This is the command I ran:

pkgsite -http=0.0.0.0:9090

from the root of the repository (directory containing go.mod file)

What did you expect to see?

Expected a godocs server to be brought up with my local repository

What did you see instead?

panic: http: multiple registrations for /home/pallav/proj/workspace/code.appn.in/

goroutine 1 [running]:
net/http.(*ServeMux).Handle(0xc000ae2ac0, {0xc0006cd230, 0x29}, {0x2c4c540?, 0xc000aefbf0})
	/home/pallav/sdk/go1.18/src/net/http/server.go:2478 +0x226
golang.org/x/pkgsite/internal/frontend.(*Server).InstallFS(0xc000aca800, {0xc0006cd200, 0x28}, {0x2c4ca00?, 0xc000671d20?})
	/home/pallav/.GO/pkg/mod/golang.org/x/pkgsite@v0.0.0-20220608150456-5c9f604fd299/internal/frontend/server.go:267 +0x105
main.newServer({0xc0003a0680?, 0x6, 0x80?}, 0x2c55238?)
	/home/pallav/.GO/pkg/mod/golang.org/x/pkgsite@v0.0.0-20220608150456-5c9f604fd299/cmd/pkgsite/main.go:220 +0x24f
main.main()
	/home/pallav/.GO/pkg/mod/golang.org/x/pkgsite@v0.0.0-20220608150456-5c9f604fd299/cmd/pkgsite/main.go:141 +0x56a

Minimal reproduction:

go.mod

module code.appn.in

go 1.18

require golang.org/x/net v0.0.0-20220607020251-c690dde0001d

a.go

package demo

import (
	"bytes"

	"golang.org/x/net/html"
)

func Something() {
	r := bytes.NewReader([]byte(`<html></html>`))
	html.NewTokenizer(r)
}

Now run

go mod tidy
pkgsite -http=0.0.0.0:9090
@gopherbot gopherbot added this to the Unreleased milestone Jun 10, 2022
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 10, 2022
@seankhliao
Copy link
Member

cc @jba
looks like not every entry has a populated GoMod field
https://cs.opensource.google/go/x/pkgsite/+/2de536eb:cmd/pkgsite/main.go;l=281

@pallavagarwal07
Copy link
Author

I suppose its because of this dependency chain

golang.org/x/net@v0.0.0-20220607020251-c690dde0001d ->
golang.org/x/text@v0.3.7 ->
golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e

How is pkg.go.dev not running into similar issues while generating the docs?

Is there a workaround I can use to generate docs in the meanwhile? We are basically stuck with no way to browse our internal documentation.

@seankhliao
Copy link
Member

If you only need the docs for a single module (not including its dependencies) -list=false

Or serve everything in the local module cache with -cache (you may need to use go get to pull your code into the cache)

@jba jba self-assigned this Jun 13, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/412058 mentions this issue: cmd/pkgsite: ignore indirect modules

@jba
Copy link
Contributor

jba commented Jun 14, 2022

Thanks everyone for the clear repro and the pointer to the offending function!

@pallavagarwal07, you can patch in that CL for a workaround.

@rsc rsc unassigned jba Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants