Skip to content

Add Go 1.18 support #1116

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

Merged
merged 51 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
98cf52b
Update 1.17 to 1.18
flimzy Apr 19, 2022
734756f
Add hacked JS files for goarch
flimzy Apr 19, 2022
75a2a4a
Update vfs
flimzy Apr 19, 2022
3a89f97
More stdlib updates
flimzy Apr 19, 2022
f754ef8
Update dependencies
flimzy Apr 19, 2022
42a2672
Ignore go:linkname directives in the `internal/fuzz` package.
nevkontakte May 30, 2022
40a9a9c
Pass an empty list of fuzz targets into the test main function.
nevkontakte May 30, 2022
dafed76
Restore mapiterinit(), mapiterkey(), mapiterelem() and mapiternext().
nevkontakte May 30, 2022
76289a7
Update VFS.
nevkontakte May 30, 2022
24891eb
Provide stubs for the string-optimized map accessors in the reflect pkg.
nevkontakte Jun 4, 2022
69c7cf6
Fix conversion from a slice to a pointer to a shorter array.
nevkontakte Jun 4, 2022
7b2b95a
Make `internal/intern` unsupported and avoid its usage in `net/netip`.
nevkontakte Jun 4, 2022
8cc14eb
strings: support Clone() function
nevkontakte Jun 4, 2022
5b30828
Use the actual NaN value in the `math` package.
nevkontakte Jun 5, 2022
243b1a4
Capture package name when unexpected compiler panic happens.
nevkontakte Jun 5, 2022
bc985d1
Improve compiler panic message.
nevkontakte Jun 5, 2022
7dcf6bb
Temporarily exclude encoding/xml from the test set.
nevkontakte Jun 5, 2022
2f017d3
net/http: fix renamed variable
nevkontakte Jun 5, 2022
28ce160
Update embedded VFS and minified prelude.
nevkontakte Jun 7, 2022
6d4ada3
Merge pull request #1120 from nevkontakte/go1.18
nevkontakte Jun 10, 2022
2bf901a
Use Function.prototype.bind() in $methodVal in prelude.
nevkontakte Jun 10, 2022
c3fd450
runtime: Filter call stack returned by `Callers()` and `Caller()`.
nevkontakte Jun 10, 2022
dfcddff
reflect: Skip memory allocation test in TestMapIterSet.
nevkontakte Jun 10, 2022
844c5db
runtime: Include call column into position key, in addition to line.
nevkontakte Jul 9, 2022
d8f1734
Update VFS and minified prelude.
nevkontakte Jul 9, 2022
aa9b527
reflect: Fix test failures introduced in Go 1.18.
nevkontakte Jul 10, 2022
58edd7e
Update VFS.
nevkontakte Jul 10, 2022
fe457d0
Merge pull request #1125 from nevkontakte/go1.18
nevkontakte Jul 21, 2022
9c7b3f9
Skip 3 gorepo tests that attempt to pass unsupported flags:
nevkontakte Jul 16, 2022
8af68a2
Mark fixedbugs/issue15975.go as passing again.
nevkontakte Jul 16, 2022
6d8aaec
Allow multiple "_" fields in `reflect.StructOf()`.
nevkontakte Jul 16, 2022
62b3001
Update VFS.
nevkontakte Jul 16, 2022
68505dc
Skip fixedbugs/issue48898.go
nevkontakte Jul 17, 2022
d92466f
Skip fixedbugs/issue48536.go, which uses `unsafe.Add()`.
nevkontakte Jul 21, 2022
405ff02
Merge pull request #1131 from nevkontakte/go1.18
nevkontakte Jul 27, 2022
4845bda
Refactor test functions finding into a separate package and add tests.
nevkontakte Jul 30, 2022
b19a3f1
Detect and execute Fuzz targets with seed inputs.
nevkontakte Jul 30, 2022
f13b14b
Fix generics-related error in net/netip fuzz tests.
nevkontakte Jul 31, 2022
2db03cc
Update VFS.
nevkontakte Jul 31, 2022
6ca1089
Merge pull request #1132 from nevkontakte/go1.18
nevkontakte Aug 1, 2022
4380695
Yield explicit errors when encountering typeparams.
nevkontakte Jul 31, 2022
c53e22e
Update VFS.
nevkontakte Jul 31, 2022
dbb7643
Remove obsolete overlay.
nevkontakte Jul 31, 2022
3dee60c
Update VFS.
nevkontakte Jul 31, 2022
f3f9c18
Remove `Wrapper` interface from `syscall/js`.
nevkontakte Jul 31, 2022
0dcf12e
Update VFS.
nevkontakte Jul 31, 2022
671ed99
Update upstream Go version to 1.18.4.
nevkontakte Jul 31, 2022
45af5f0
go/parser: skip TestParseDepthLimit test, which triggers stack overflow.
nevkontakte Jul 31, 2022
b9d9b53
Update VFS
nevkontakte Jul 31, 2022
918cc1e
Add fixedbugs/issue53600.go to known failures.
nevkontakte Aug 1, 2022
7736106
Merge pull request #1133 from nevkontakte/go1.18
nevkontakte Aug 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/measure-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: '~1.17.9'
go-version: '~1.18.4'
- uses: gopherjs/output-size-action/measure@main
with:
name: jQuery TodoMVC
Expand Down
2 changes: 2 additions & 0 deletions .std_test_pkg_exclusions
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
embed/internal/embedtest
encoding/xml
go/build
go/internal/srcimporter
go/types
internal/abi
internal/intern
internal/syscall/windows
internal/syscall/windows/registry
internal/syscall/windows/sysdll
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ GopherJS compiles Go code ([golang.org](https://golang.org/)) to pure JavaScript

### What's new?

- 2022-XX-XX: Go 1.18 support is available
- 2021-09-19: Go 1.17 support is available!
- 2021-08-23: Go Modules are now fully supported.
- 2021-06-19: Complete `syscall/js` package implementation compatible with the upstream Go 1.16.
Expand All @@ -31,7 +32,7 @@ Nearly everything, including Goroutines ([compatibility documentation](https://g

### Installation and Usage

GopherJS [requires Go 1.17 or newer](https://github.com/gopherjs/gopherjs/blob/master/doc/compatibility.md#go-version-compatibility). If you need an older Go
GopherJS [requires Go 1.18 or newer](https://github.com/gopherjs/gopherjs/blob/master/doc/compatibility.md#go-version-compatibility). If you need an older Go
version, you can use an [older Gopher release](https://github.com/gopherjs/gopherjs/releases).

Get or update GopherJS and dependencies with:
Expand All @@ -40,12 +41,12 @@ Get or update GopherJS and dependencies with:
go get -u github.com/gopherjs/gopherjs
```

If your local Go distribution as reported by `go version` is newer than Go 1.17, then you need to set the `GOPHERJS_GOROOT` environment variable to a directory that contains a Go 1.17 distribution. For example:
If your local Go distribution as reported by `go version` is newer than Go 1.18, then you need to set the `GOPHERJS_GOROOT` environment variable to a directory that contains a Go 1.18 distribution. For example:

```
go get golang.org/dl/go1.17.1
go1.17.1 download
export GOPHERJS_GOROOT="$(go1.17.1 env GOROOT)" # Also add this line to your .profile or equivalent.
go get golang.org/dl/go1.18.1
go1.18.1 download
export GOPHERJS_GOROOT="$(go1.18.1 env GOROOT)" # Also add this line to your .profile or equivalent.
```

Now you can use `gopherjs build [package]`, `gopherjs build [files]` or `gopherjs install [package]` which behave similar to the `go` tool. For `main` packages, these commands create a `.js` file and `.js.map` source map in the current directory or in `$GOPATH/bin`. The generated JavaScript file can be used as usual in a website. Use `gopherjs help [command]` to get a list of possible command line flags, e.g. for minification and automatically watching for changes.
Expand Down
4 changes: 4 additions & 0 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ func parseAndAugment(xctx XContext, pkg *PackageData, isTest bool, fileSet *toke
s := spec.(*ast.TypeSpec)
if replacedDeclNames[s.Name.Name] {
s.Name = ast.NewIdent("_")
s.Type = &ast.StructType{Struct: s.Pos(), Fields: &ast.FieldList{}}
s.TypeParams = nil
}
}
case token.VAR, token.CONST:
Expand Down Expand Up @@ -364,6 +366,7 @@ func (p *PackageData) InternalBuildContext() *build.Context {
func (p *PackageData) TestPackage() *PackageData {
return &PackageData{
Package: &build.Package{
Name: p.Name,
ImportPath: p.ImportPath,
Dir: p.Dir,
GoFiles: append(p.GoFiles, p.TestGoFiles...),
Expand All @@ -379,6 +382,7 @@ func (p *PackageData) TestPackage() *PackageData {
func (p *PackageData) XTestPackage() *PackageData {
return &PackageData{
Package: &build.Package{
Name: p.Name + "_test",
ImportPath: p.ImportPath + "_test",
Dir: p.Dir,
GoFiles: p.XTestGoFiles,
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ workflows:
parameters:
go_version:
type: string
default: "1.17.9"
default: "1.18.4"
nvm_version:
type: string
default: "0.38.0"
Expand Down
8 changes: 4 additions & 4 deletions compiler/gopherjspkg/fs_vfsdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler/linkname.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func parseGoLinknames(fset *token.FileSet, pkgPath string, file *ast.File) ([]Go

decl := obj.Decl.(*ast.FuncDecl)
if decl.Body != nil {
if pkgPath == "runtime" || pkgPath == "internal/bytealg" {
if pkgPath == "runtime" || pkgPath == "internal/bytealg" || pkgPath == "internal/fuzz" {
// These standard library packages are known to use unsupported
// "insert"-style go:linkname directives, which we ignore here and handle
// case-by-case in native overrides.
Expand Down
Loading