You don't even need to run `go clean`. Go will automatically detect whether
stuff needs to be rebuilt, as the Go version used to build a package is
part of a hash, that is used as a key for the build cache.
And yes, it will use the standard library packages of the Go version that
is installed (the one output by `go env GOROOT`). In fact, if you just
change the on-disk content of those packages (e.g. edit `$(go env
GOROOT)/src/fmt/format.go`) it will automatically detect that and rebuild
the changed standard library packages as needed, just like it would with a
first party package. This can be a very useful (and fun) debugging tool, as
it means you can actually insert debug printfs *into the stdlib* to see
what is happening.

All of this assumes your Go installation is setup correctly, of course.

On Thu, Jan 11, 2024 at 2:08 AM Andrew Athan <andrew...@gmail.com> wrote:

> Say I install golang 1.20.12 and go clean -cache and go clean -modcache.
>
> Then I build.
>
> Will that executable be using crypto/tls and other packages "as they were
> in 1.20.12"? Or is golang fetching the newest available compatible sources,
> and therefore I may be spinning my wheels trying to see if there is a bug
> in the latest crypto/tls?
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/golang-nuts/597a23f1-e212-455a-b621-e64108281da8n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/597a23f1-e212-455a-b621-e64108281da8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfG%3DQytK_T5tOAu0_srkrVsfFVjdyKx8XZYi-opMotfxKQ%40mail.gmail.com.

Reply via email to