Skip to content

Commit

Permalink
all: handle Go 1.18 code on Go 1.16 AppEngine using new internal/back…
Browse files Browse the repository at this point in the history
…port/go/*

The immediate need was go/build, because the Go 1.16 go/build rejects
code that has //go:build without // +build, as Go 1.18 code now does.

But displaying code using generics would also have failed, for inability
to parse that code. Add the full go/ast, go/doc, go/format, go/parser,
go/printer, go/scanner, and go/token to fix those failures, which
would become more frequent as generics are used more inside the
standard library.

The code is all from the go1.18 tag of the Go repo, post-processed to
rewrite imports and apply gofmt -w -r 'any -> interface{}' to keep it
building with the other backports and with Go 1.16 syntax.

For golang/go#51686.

Change-Id: I1e14f4634d8bc09bdaa04c014eadb1be97ea5047
Reviewed-on: https://go-review.googlesource.com/c/website/+/393194
Trust: Russ Cox <[email protected]>
Run-TryBot: Russ Cox <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
MK825 committed Mar 15, 2022
1 parent 4289d41 commit 76a9fbf
Show file tree
Hide file tree
Showing 226 changed files with 42,390 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cmd/golangorg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"errors"
"flag"
"fmt"
"go/format"
"io/fs"
"io/ioutil"
"log"
Expand All @@ -32,6 +31,7 @@ import (
"cloud.google.com/go/datastore"
"golang.org/x/build/repos"
"golang.org/x/website"
"golang.org/x/website/internal/backport/go/format"
"golang.org/x/website/internal/backport/html/template"
"golang.org/x/website/internal/blog"
"golang.org/x/website/internal/codewalk"
Expand Down
3 changes: 2 additions & 1 deletion internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
package api

import (
"go/build"
"os"
"runtime"
"testing"

"golang.org/x/website/internal/backport/go/build"
)

func TestParseVersionRow(t *testing.T) {
Expand Down
Loading

0 comments on commit 76a9fbf

Please sign in to comment.