Skip to content
Permalink
Browse files

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
  • Loading branch information
flimzy committed Feb 17, 2020
1 parent 89e6cbc commit fce0ec30dd00773d3fa974351d04ce2737b5c4d9
Showing with 6 additions and 1 deletion.
  1. +1 −1 build/build.go
  2. +5 −0 compiler/version_check.go
@@ -67,7 +67,7 @@ func NewBuildContext(installSuffix string, buildTags []string) *build.Context {
"netgo", // See https://godoc.org/net#hdr-Name_Resolution.
"purego", // See https://golang.org/issues/23172.
),
ReleaseTags: build.Default.ReleaseTags,
ReleaseTags: build.Default.ReleaseTags[:compiler.GoVersion],
CgoEnabled: true, // detect `import "C"` to throw proper error

IsDir: func(path string) bool {
@@ -1,3 +1,5 @@
// +build go1.12

package compiler

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

// GoVersion is the current Go 1.x version that GopherJS is compatible with.
const GoVersion = 12

// CheckGoVersion checks the version of the Go distribution
// at goroot, and reports an error if it's not compatible
// with this version of the GopherJS compiler.

0 comments on commit fce0ec3

Please sign in to comment.
You can’t perform that action at this time.