Skip to content

playground: Explicitly set GOARCH=js during go generate. #66

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
wants to merge 1 commit into from

Conversation

dmitshur
Copy link
Member

@dmitshur dmitshur commented Mar 13, 2017

This is needed after gopherjs/gopherjs#594 was resolved (/cc @bep), because in Go 1.8, go generate sets GOARCH to source platform it's running on, but we want it to be either unset or GOARCH=js.

This is very similar to issue gopherjs/gopherjs#601 (/cc @DrJosh9000).

Also use tabs rather than spaces for indentation (since it no longer aligns anyway).

This was used locally to generate 37d9884.

This is needed after gopherjs/gopherjs#594 was resolved, because in Go
1.8, go generate sets GOARCH to source platform it's running on, but we
want it to be either unset or GOARCH=js.

This is very similar to issue gopherjs/gopherjs#601.

Also use tabs rather than spaces for indentation (since it no longer
aligns anyway).
@dmitshur dmitshur requested a review from neelance March 13, 2017 23:09
Copy link
Member

@neelance neelance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this change. GOARCH=js gopherjs build and GOARCH=js gopherjs install seem redundant to me. Why do we need to set the env var there? How is that related to go generate?

@dmitshur
Copy link
Member Author

dmitshur commented Mar 14, 2017

@neelance Did you read the PR description or commit message, and it's still unclear? I can elaborate further, just want to make sure you didn't miss this:

This is needed after gopherjs/gopherjs#594 was resolved, because in Go 1.8, go generate sets GOARCH to source platform it's running on, but we want it to be either unset or GOARCH=js.

This is very similar to issue gopherjs/gopherjs#601.

Without this change, you'd get the following error:

gopherjs: unsupported GOOS/GOARCH pair darwin/amd64

@neelance
Copy link
Member

Yeah, I read it, but I didn't understand. Now that I looked again it is suddenly clear to me. ;-) But I have to say: Are we really sure that failing on a bad GOARCH is a good idea? To me this seems a lot like ease of use should win by just always ignoring GOARCH. Imho there is no proper benefit in the current solution. I liked it at first to be consistent with gc, but now I see the issues that it creates.

@dmitshur
Copy link
Member Author

dmitshur commented Mar 14, 2017

I'm not sure. I thought that users would only ever run into the issue if they explicitly set wrong GOARCH themselves. But that was before I found out that go generate always sets GOOS, GOARCH, etc.

Given that GopherJS only supports one value for target architecture, and never will support other targets (presumably), ignoring GOARCH env var is a valid option too.

But what do we do about GOOS?

@neelance
Copy link
Member

But that was before I found out that go generate always sets GOOS, GOARCH, etc.

Exactly. Same here.

But what do we do about GOOS?

There is no issue with that, right? So keep it as is.

dmitshur added a commit to gopherjs/gopherjs that referenced this pull request Mar 14, 2017
This reverts commit 62bca28.

We've originally discussed two possible fixes in issue #594:

> The gopherjs tool does not use the GOARCH environment variable
> in any way. Internally, GopherJS always uses js as GOARCH value
> when compiling user code, but it does other internal stuff when
> compiling standard library.
>
> 1. One fix is to make the gopherjs tool really ignore GOARCH env
> var. In other words, setting it to any value should have no effect;
> it shouldn't cause this failure.
>
> 2. We could also consider making it use the value of GOARCH, and
> error out if it's set to anything other than js (which is the
> default and the only supported value). Since gopherjs can't compile
> for any other architectures.

Upon further consideration, after seeing issue #601 and gopherjs/gopherjs.github.io#66,
we've decided (see discussion in gopherjs/gopherjs.github.io#66 (comment))
to revisit this issue and change gopherjs to completely ignore GOARCH
environment variable, instead of requiring it to be unset or equal to
js.

Closes #601.
Updates #594.
dmitshur added a commit to gopherjs/gopherjs that referenced this pull request Mar 14, 2017
This reverts commit 62bca28.

We've originally discussed two possible fixes in issue #594:

> The gopherjs tool does not use the GOARCH environment variable
> in any way. Internally, GopherJS always uses js as GOARCH value
> when compiling user code, but it does other internal stuff when
> compiling standard library.
>
> 1. One fix is to make the gopherjs tool really ignore GOARCH env
> var. In other words, setting it to any value should have no effect;
> it shouldn't cause this failure.
>
> 2. We could also consider making it use the value of GOARCH, and
> error out if it's set to anything other than js (which is the
> default and the only supported value). Since gopherjs can't compile
> for any other architectures.

Upon further consideration, after seeing issue #601 and gopherjs/gopherjs.github.io#66,
we've decided (see discussion in gopherjs/gopherjs.github.io#66 (comment))
to revisit this issue and change gopherjs to completely ignore GOARCH
environment variable, instead of requiring it to be unset or equal to js.

Closes #601.
Updates #594.
@dmitshur
Copy link
Member Author

This PR is no longer needed after gopherjs/gopherjs#605. Closing.

@dmitshur dmitshur closed this Mar 14, 2017
@dmitshur dmitshur deleted the set-GOARCH-js branch March 14, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants