Skip to content

doc: document that now that js is a GOOS that can break existing packages #26329

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

Closed
VojtechVitek opened this issue Jul 11, 2018 · 6 comments
Closed
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@VojtechVitek
Copy link

I found a build regression when building a large monorepo when trying out Go 1.11-beta1.

Please check out this repo: github.com/VojtechVitek/go1.11, the simplest reproducer I came up with.

Go 1.10.3

$ go version
go version go1.10.3 darwin/amd64

$ go run main.go
OK

Go 1.11-beta1

$ go version
go version go1.11beta1 darwin/amd64

$ go run main.go
# command-line-arguments
./main.go:11:6: undefined: addons.CustomJS

Looks like Go 1.11-beta1 ignores the addons/custom_js.go file for some reason.

Is _js.go suffix somehow magical now because of the js/wasm support?

Is this intended? I don't think I saw this in the Go 1.11 DRAFT release notes.

Thanks!

System details

go version go1.11beta1 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/vojtechvitek/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/vojtechvitek/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hr/5zb8r0yx4sv4_1dc0rlccflm0000gn/T/go-build846962860=/tmp/go-build -gno-record-gcc-switches -fno-common"
VGOMODROOT=""
GOROOT/bin/go version: go version go1.11beta1 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.11beta1
uname -v: Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.3
BuildVersion:	17D47
lldb --version: lldb-902.0.79.2
  Swift-4.1
@ianlancetaylor ianlancetaylor changed the title Go 1.11-beta1: A potential Go 1.11-beta1 build regression go/build: adding js as a GOOS breaks an existing package Jul 11, 2018
@ianlancetaylor
Copy link
Contributor

This is an unfortunate consequence of adding js as a recognized GOOS value. It means that files named "xxx_js.go" will now only be built when building for WASM. We've run into this problem before. I don't know of a good solution. Clearly it needs to be documented.

@ianlancetaylor ianlancetaylor added Documentation Issues describing a change to documentation. release-blocker NeedsFix The path to resolution is known, but the work has not been done. labels Jul 11, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Jul 11, 2018
@ianlancetaylor ianlancetaylor changed the title go/build: adding js as a GOOS breaks an existing package doc: document that now that js is a GOOS that can break existing packages Jul 11, 2018
@ianlancetaylor
Copy link
Contributor

CC @andybons

@davecheney
Copy link
Contributor

davecheney commented Jul 11, 2018 via email

@VojtechVitek
Copy link
Author

Documenting for others, since the issue was renamed:

Issue: Go 1.11 ignores *_js.go files when building the source code

(unless you explicitly build for GOOS=js WASM target)

Fix: Rename *_js.go files to *_javascript.go or similar

@andybons
Copy link
Member

@neelance

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/123416 mentions this issue: doc: mention that *_js.go files are now ignored and treated like a GOOS

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants