On Sat, Jul 12, 2025 at 6:55 PM Qingwei Li <qingweili2...@gmail.com> wrote:
>
> Currently, the bootstrap process of `./make.bash` generate a project in 
> /pkg/bootstrap/src/bootstrap and then install bootstrap tools like compile, 
> asm, link, etc. However, it does not support vendor package now, i.e. the 
> go.mod in bootstrap project contains no vendor packages. It's just plain as 
> follows:
>
> module bootstrap
> go 1.22
>
> If the cmd developers import vendor packages in cmd/compile, cmd/asm and 
> other bootstrap tools, then it will fail because vendor packages are not 
> written in go.mod.
>
> So I try to solve the problem. In the last 2 commits of 
> https://github.com/Lslightly/go/commits/bootstrap_vendor_copy/, I copy 
> cmd/vendor to bootstrap/vendor and copy cmd/go.mod to bootstrap/go.mod with 
> its module name and go version modified according to the minimal required 
> bootstrap go version. I also change the `go install -tags="..." 
> bootstrap/cmd/...` to `go install -tags="..." -mod=vendor bootstrap/cmd/...` 
> to import packages in bootstrap/vendor directory.
>
> After the above changes, it now supports importing vendor packages in 
> cmd/compile by following steps:
>
> 1. import vendor packages in code, like src/cmd/compile/internal/x.go
> 2. run go get <pkg> and go mod vendor in src/cmd/ directory
> 3. run ./make.bash in src/ directory to rebuild the whole toolchain.
>
> What's your idea about these two commits? Is the feature wanted, since it 
> enables importing vendor packages in cmd/compile, cmd/asm?
>
> Related issues: https://github.com/golang/go/issues/74563 and 
> https://forum.golangbridge.org/t/go-cmd-compile-add-package/39214

But cmd/compile/internal/gc imports cmd/internal/telemetry/counter
imports cmd/vendor/golang.org/x/telemetry/counter. So it at least
somewhat already works to have cmd/compile import vendored packages.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW2gZLVMSr5M-6qWCOSUPyEjs-Z6TJOyYoJd%2B-L5MDggQ%40mail.gmail.com.

Reply via email to