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

Adopt go 1.21 #2614

Merged
merged 1 commit into from
Aug 21, 2023
Merged

Adopt go 1.21 #2614

merged 1 commit into from
Aug 21, 2023

Commits on Aug 14, 2023

  1. Adopt go 1.21

    This change moves us to use Go 1.21 for building `azd`.
    
    As part of go 1.21, the `maps`, `slices` and `slog` packages,
    previously in `golang.org/x/exp` have been moved into the standard
    libary. As part of this change, I've moved to use these versions of
    the packages instead of using the experimental versions.
    
    However, there were a few places where we were using `maps.Keys`,
    which was not added to the standard
    library. https://go-review.googlesource.com/c/go/+/513715 explains the
    rationale here, they may want `Keys` to return an iterator, and were
    not comfortable locking the name at this time. This functionality will
    be added to the `maps` package in a future release, it seems, likely
    under a name like `KeysSlice`.  For now, I just kept the existing use
    of the the experimental package. We can update the import path and
    move to the stdlib version when it lands later.
    
    This change also updates `go.mod` to declare that we need at least go
    1.21 to build `azd`. Developers which haven't upgraded will see build
    errors due to references of `maps`, `slices` and `log/slog` which do
    not exist in earlier versions of the standard libary.
    
    I've also enabled the loopvar experiment for our CI builds and
    tests. https://github.com/golang/go/wiki/LoopvarExperiment gives more
    information on what this does, but the long and short of it is that
    this behavior is likely to become the default in a future version of
    go, and the semantics of it more closely match what developers expect,
    so I would like us to just lock in the changes now (we are presently
    clean on this, so there are no changes, I just don't want us to
    introduce any new bad uses).
    ellismg committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    8cb63e1 View commit details
    Browse the repository at this point in the history