golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.96k stars 17.67k forks source link

x/pkgsite/cmd/pkgsite: Unable to fetch std@Latest Pkgsite documentation for Local Main go Repo : https://go.googlesource.com/go #63744

Open Goclipse27 opened 1 year ago

Goclipse27 commented 1 year ago

What version of Go are you using (go version)?

$ go version
go1.21.3

Does this issue reproduce with the latest release?

Yes. But the ultimate intention is to run pkgsite for main go repository - std@latest against master(1.22) branch.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
Windows, amd64, gcc

What did you do?

1. git clone https://go.googlesource.com/go/
2. git checkout go1.21.3
3. git switch -c go1.21.3
4. C:\Users\R\golang\go\src> all.bat
------------------------------------
GOARCH: amd64
GOOS: windows
OS Version: 10.0.22621

ALL TESTS PASSED

Installed Go for windows/amd64 in C:\Users\R\golang\go
Installed commands in C:\Users\R\golang\go\bin
*** You need to add C:\Users\R\golang\go\bin to your PATH.

-------------------------------------
5. go install golang.org/x/pkgsite/cmd/pkgsite@latest
6. C:\Users\R\golang\go\src>pkgsite .

C:\Users\R\golang\go\src>pkgsite .
2023/10/25 16:29:15 Info: go/packages.Load(["all"]) loaded 277 packages from . in 655.6654ms
2023/10/25 16:29:15 Info: go/packages.Load(std) loaded 0 packages from C:\Program Files\Go in 9.2327ms
2023/10/25 16:29:15 Error: loading packages from stdlib: err: fork/exec C:\Users\R\golang\go\bin\go.exe: The parameter is incorrect.: stderr:
2023/10/25 16:29:15 Info: Listening on addr http://localhost:8080
2023/10/25 16:29:51 Info: FetchDataSource: fetching std@latest
2023/10/25 16:34:10 Error: serveUnitPage(ctx, w, r, ds, &{std std latest}): FetchDataSource.GetUnitMeta("std", "std", "latest"): FetchDataSource.findModule("std", "std", "latest"): FetchDataSource.getModule("std", "latest"): FetchModule("std", "latest"): stdlib.ContentDir("latest"): remoteGoRepo.clone("v1.21.3"): running git fetch: exit status 128: fatal: refusing to fetch into branch 'refs/heads/main' checked out at 'C:/Users/R/AppData/Local/Temp/1087088232'

What did you expect to see?

I was hoping to see the documentation website like pkg.go.dev and std libs listed and to look at their documentation.

What did you see instead?

Screenshot 2023-10-25 165655

Goclipse27 commented 1 year ago

When I try pkgsite with proxy I get below error

pkgsite -proxy (GOPROXY - https://proxy.golang.org,direct)

BYPASSING LICENSE CHECKING: MAY DISPLAY NON-REDISTRIBUTABLE INFORMATION 2023/10/28 17:24:30 Info: go/packages.Load(std) loaded 0 packages from C:\Program Files\Go in 22.9285ms 2023/10/28 17:24:30 Error: loading packages from stdlib: err: fork/exec C:\Program Files\Go\bin\go.exe: The parameter is incorrect.: stderr: 2023/10/28 17:24:30 Info: Listening on addr http://localhost:8080 2023/10/28 17:25:09 Info: FetchDataSource: fetching std@latest 2023/10/28 17:25:09 Info: FetchDataSource: fetched std@latest using *fetch.proxyModuleGetter in 5.7355ms with error FetchModule("std", "latest"): proxy.Client.Info("std", "latest"): Client.readBody("std", "latest", "info"): Client.escapedURL("std", "latest", "info"): path: malformed module path "std": missing dot in first path element: invalid argument 2023/10/28 17:25:09 Error: serveUnitPage(ctx, w, r, ds, &{std std latest}): FetchDataSource.GetUnitMeta("std", "std", "latest"): FetchDataSource.findModule("std", "std", "latest"): FetchDataSource.getModule("std", "latest"): FetchModule("std", "latest"): proxy.Client.Info("std", "latest"): Client.readBody("std", "latest", "info"): Client.escapedURL("std", "latest", "info"): path: malformed module path "std": missing dot in first path element: invalid argument

Note: However, when I tried local packages(Cloned from repo to local), they are working , screenshots attached.

Screenshot 2023-10-28 170017

Goclipse27 commented 1 year ago

@bcmills - I have my local devel golang - set GOVERSION=devel go1.22-b5f87b5407 Tue Oct 24 20:28:25 2023 +0000 and GOROOT and tools are all local development directory. It is not able to show pkgsite and has shown above errors.

However when I point my GOROOT to my base golang installation "C:\Program Files\go" (go1.21.3) and respective set GOTOOLDIR, I am able to see the local stdlib code changes reflecting in the documentation. Looks like I am using different toolchain here to render local development stdlib documentation on pkgsite? Is this an issue to be reported?

findleyr commented 1 year ago

CC @matloob @jba

Michael, could this be related to recent cmd/pkgsite changes?

matloob commented 1 year ago

@findleyr yes, I think it is related to the recent cmd/pkgsite changes.

findleyr commented 1 year ago

@matloob thanks, tentatively assigned to you to investigate further.

gopherbot commented 1 year ago

Change https://go.dev/cl/540635 mentions this issue: internal/stdlib: pass -f to git fetch in remoteGoRepo.clone

matloob commented 1 year ago

I was able to reproduce the Error: loading packages from stdlib: err: fork/exec $GOROOT\bin\go.exe: The parameter is incorrect.: stderr: error on Windows. Seems like it's only happening there.

The refusing to fetch into branch 'refs/heads/main' may be the same as issue #63254