Skip to content

Commit fa8544d

Browse files
authored
Merge pull request #1116 from gopherjs/go1.18
Add Go 1.18 support
2 parents f2ebe46 + 7736106 commit fa8544d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1435
-425
lines changed

.github/workflows/measure-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fetch-depth: 0
1212
- uses: actions/setup-go@v2
1313
with:
14-
go-version: '~1.17.9'
14+
go-version: '~1.18.4'
1515
- uses: gopherjs/output-size-action/measure@main
1616
with:
1717
name: jQuery TodoMVC

.std_test_pkg_exclusions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
embed/internal/embedtest
2+
encoding/xml
23
go/build
34
go/internal/srcimporter
45
go/types
56
internal/abi
7+
internal/intern
68
internal/syscall/windows
79
internal/syscall/windows/registry
810
internal/syscall/windows/sysdll

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ GopherJS compiles Go code ([golang.org](https://golang.org/)) to pure JavaScript
1616

1717
### What's new?
1818

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

3233
### Installation and Usage
3334

34-
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
35+
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
3536
version, you can use an [older Gopher release](https://github.com/gopherjs/gopherjs/releases).
3637

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

43-
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:
44+
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:
4445

4546
```
46-
go get golang.org/dl/go1.17.1
47-
go1.17.1 download
48-
export GOPHERJS_GOROOT="$(go1.17.1 env GOROOT)" # Also add this line to your .profile or equivalent.
47+
go get golang.org/dl/go1.18.1
48+
go1.18.1 download
49+
export GOPHERJS_GOROOT="$(go1.18.1 env GOROOT)" # Also add this line to your .profile or equivalent.
4950
```
5051

5152
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.

build/build.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ func parseAndAugment(xctx XContext, pkg *PackageData, isTest bool, fileSet *toke
267267
s := spec.(*ast.TypeSpec)
268268
if replacedDeclNames[s.Name.Name] {
269269
s.Name = ast.NewIdent("_")
270+
s.Type = &ast.StructType{Struct: s.Pos(), Fields: &ast.FieldList{}}
271+
s.TypeParams = nil
270272
}
271273
}
272274
case token.VAR, token.CONST:
@@ -396,6 +398,7 @@ func (p *PackageData) InternalBuildContext() *build.Context {
396398
func (p *PackageData) TestPackage() *PackageData {
397399
return &PackageData{
398400
Package: &build.Package{
401+
Name: p.Name,
399402
ImportPath: p.ImportPath,
400403
Dir: p.Dir,
401404
GoFiles: append(p.GoFiles, p.TestGoFiles...),
@@ -411,6 +414,7 @@ func (p *PackageData) TestPackage() *PackageData {
411414
func (p *PackageData) XTestPackage() *PackageData {
412415
return &PackageData{
413416
Package: &build.Package{
417+
Name: p.Name + "_test",
414418
ImportPath: p.ImportPath + "_test",
415419
Dir: p.Dir,
416420
GoFiles: p.XTestGoFiles,

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ workflows:
5454
parameters:
5555
go_version:
5656
type: string
57-
default: "1.17.9"
57+
default: "1.18.4"
5858
nvm_version:
5959
type: string
6060
default: "0.38.0"

compiler/gopherjspkg/fs_vfsdata.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/linkname.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func parseGoLinknames(fset *token.FileSet, pkgPath string, file *ast.File) ([]Go
116116

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

0 commit comments

Comments
 (0)