Skip to content

Commit fce0ec3

Browse files
authored
build: use build context ReleaseTags slice that goes to go1.12 only
We want GopherJS 1.12-3 to have predictable behavior when building packages regardless of the version of Go it was built with; it should not be matching files with "// +build go1.13" constraints some times but not other times. Previously, ReleaseTags of the default build context were inherited from the Go version used to build GopherJS, which may be newer than Go 1.12. This change makes it have ReleaseTags that go up to go1.12 always. That corresponds to the major version of Go and its standard library that is supported by GopherJS 1.12-3. Fixes #969. GitHub-Pull-Request: #970
1 parent 89e6cbc commit fce0ec3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewBuildContext(installSuffix string, buildTags []string) *build.Context {
6767
"netgo", // See https://godoc.org/net#hdr-Name_Resolution.
6868
"purego", // See https://golang.org/issues/23172.
6969
),
70-
ReleaseTags: build.Default.ReleaseTags,
70+
ReleaseTags: build.Default.ReleaseTags[:compiler.GoVersion],
7171
CgoEnabled: true, // detect `import "C"` to throw proper error
7272

7373
IsDir: func(path string) bool {

compiler/version_check.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build go1.12
2+
13
package compiler
24

35
import (
@@ -10,6 +12,9 @@ import (
1012
// Version is the GopherJS compiler version string.
1113
const Version = "1.12-3"
1214

15+
// GoVersion is the current Go 1.x version that GopherJS is compatible with.
16+
const GoVersion = 12
17+
1318
// CheckGoVersion checks the version of the Go distribution
1419
// at goroot, and reports an error if it's not compatible
1520
// with this version of the GopherJS compiler.

0 commit comments

Comments
 (0)