From 12a247d9a8bfdd5cdc8bf10feb88d70b7b3e4f14 Mon Sep 17 00:00:00 2001 From: Grant Nelson Date: Tue, 30 Jan 2024 16:26:14 -0700 Subject: [PATCH 1/3] Fix problem where import is named but source is augmented to only need import for a directive --- build/build.go | 2 ++ build/build_test.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build/build.go b/build/build.go index a6832a607..d3cd32952 100644 --- a/build/build.go +++ b/build/build.go @@ -475,6 +475,8 @@ func pruneImports(file *ast.File) { path, _ := strconv.Unquote(in.Path.Value) directivePrefix, hasPath := directiveImports[path] if hasPath && astutil.HasDirectivePrefix(file, directivePrefix) { + // since the import is otherwise unused set the name to blank. + in.Name = ast.NewIdent(`_`) delete(unused, name) if len(unused) == 0 { return diff --git a/build/build_test.go b/build/build_test.go index f54281cb8..5f025540b 100644 --- a/build/build_test.go +++ b/build/build_test.go @@ -396,7 +396,14 @@ func TestOverlayAugmentation(t *testing.T) { //go:linkname runtimeNano runtime.nanotime func runtimeNano() int64`, - noCodeChange: true, + want: `import _ "unsafe" + import "embed" + + //go:embed hello.txt + var eFile embed.FS + + //go:linkname runtimeNano runtime.nanotime + func runtimeNano() int64`, expInfo: map[string]overrideInfo{ `eFile`: {}, `runtimeNano`: {}, From 4b5b0771d02d2db3484258727e59c151284034f5 Mon Sep 17 00:00:00 2001 From: Grant Nelson Date: Tue, 30 Jan 2024 16:27:48 -0700 Subject: [PATCH 2/3] Fix chocolatey go version --- circle.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 62031ce4b..5c059a6e4 100644 --- a/circle.yml +++ b/circle.yml @@ -55,6 +55,10 @@ parameters: go_version: type: string default: "1.19.13" + chocolatey_go_version: + type: string + # Chocolatey doesn't have 1.19.13, closest is 1.19.9 + default: "1.19.9" nvm_version: type: string default: "0.38.0" @@ -171,7 +175,7 @@ jobs: - run: name: Install Go command: | - choco install golang --version="<< pipeline.parameters.go_version >>" -my + choco install golang --version="<< pipeline.parameters.chocolatey_go_version >>" -my go version (Get-Command go).Path [Environment]::SetEnvironmentVariable( From d7abc77ddbbc45ec6aa20a8f10c8840de5f1017b Mon Sep 17 00:00:00 2001 From: Grant Nelson Date: Tue, 30 Jan 2024 16:30:19 -0700 Subject: [PATCH 3/3] Update known fails list of fixed bugs --- tests/gorepo/run.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/gorepo/run.go b/tests/gorepo/run.go index 0ceb99ff5..d58968ada 100644 --- a/tests/gorepo/run.go +++ b/tests/gorepo/run.go @@ -151,10 +151,16 @@ var knownFails = map[string]failReason{ // These are new tests in Go 1.18 "fixedbugs/issue46938.go": {category: notApplicable, desc: "tests -d=checkptr compiler mode, which GopherJS doesn't support"}, "fixedbugs/issue47928.go": {category: notApplicable, desc: "//go:nointerface is a part of GOEXPERIMENT=fieldtrack and is not supported by GopherJS"}, - "fixedbugs/issue49665.go": {category: other, desc: "attempts to pass -gcflags=-G=3 to enable generics, GopherJS doesn't expect the flag; re-enable in Go 1.19 where the flag is removed"}, "fixedbugs/issue48898.go": {category: other, desc: "https://github.com/gopherjs/gopherjs/issues/1128"}, "fixedbugs/issue48536.go": {category: usesUnsupportedPackage, desc: "https://github.com/gopherjs/gopherjs/issues/1130"}, "fixedbugs/issue53600.go": {category: lowLevelRuntimeDifference, desc: "GopherJS println format is different from Go's"}, + + // These are new tests in Go 1.19 + "fixedbugs/issue50672.go": {category: usesUnsupportedGenerics, desc: "Checking function nesting with one function having a type parameter."}, + "fixedbugs/issue53137.go": {category: usesUnsupportedGenerics, desc: "Checking setting type parameter of struct in parameter of a generic function."}, + "fixedbugs/issue53309.go": {category: usesUnsupportedGenerics, desc: "Checking unused type parameter in method call to interface"}, + "fixedbugs/issue53635.go": {category: usesUnsupportedGenerics, desc: "Checking switch type against nil type with unsupported type parameters"}, + "fixedbugs/issue53653.go": {category: lowLevelRuntimeDifference, desc: "GopherJS println format of int64 is different from Go's"}, } type failCategory uint8 @@ -164,6 +170,7 @@ const ( neverTerminates // Test never terminates (so avoid starting it). usesUnsupportedPackage // Test fails because it imports an unsupported package, e.g., "unsafe". requiresSourceMapSupport // Test fails without source map support (as configured in CI), because it tries to check filename/line number via runtime.Caller. + usesUnsupportedGenerics // Test uses generics (type parameters) that are not currently supported. compilerPanic unsureIfGopherJSSupportsThisFeature lowLevelRuntimeDifference // JavaScript runtime behaves differently from Go in ways that are difficult to work around.