-
Notifications
You must be signed in to change notification settings - Fork 11
playground: Improve update.sh to be more general. #41
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
Conversation
a778959
to
1db5d32
Compare
This is based on work in #41, which allows this entire step to be done in a matter of seconds by simply running one command: go generate github.com/gopherjs/gopherjs.github.io/playground And it works even with multiple GOPATHs, and non-writeable GOROOT. \o/
Why not use |
That's a good idea, thanks. I didn't include it in the first version because I knew I couldn't just get GOROOT env var, as it may not be set. But using I'll update to include that enhancement (within an hour). |
|
||
PKG=$GOPATH/src/github.com/gopherjs/gopherjs.github.io/playground/pkg | ||
# The GOPATH workspace where the GopherJS project is. | ||
GOPHERJSGOPATH=`go list -f '{{.Root}}' github.com/gopherjs/gopherjs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using $()
instead of backticks. Backticks aren't technically deprecated, though style guidelines usually suggest sticking to $()
.
Same for line 24 (which you didn't touch in this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'll do that. I didn't know what the difference between two was, but I went with backticks because I've used them more in the past.
c379508
to
382e053
Compare
rm -r /tmp/gopherjsplayground_goroot | ||
rm -r /tmp/gopherjsplayground_gopath | ||
|
||
rename 's/\.a/\.a.js/' $(find $PKG -name "*.a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(GitHub is hiding my previous, still relevant, comment about this line because it subtly changed; leaving this comment so it's not forgotten)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be written with find -exec instead.
I agree. I mentioned this in #36 too:
- It requires
rename
command, which can be acquired withbrew install rename
but if possible, it'd be better not to require it. It can be replaced with a < 50 line Go program inside the repo, that way no external dependencies are needed.
I consider it out of scope of this PR (meaning I don't want to block this PR from being merged until it's done), but it's a welcome followup.
This is based on work in #41, which allows this entire step to be done in a matter of seconds by simply running one command: go generate github.com/gopherjs/gopherjs.github.io/playground And it works even with multiple GOPATHs, and non-writeable GOROOT. \o/
LGTM otherwise. There are some improvements that could be made to the shell script, but they're not strictly necessary for this PR. |
It uses a temporary staging folder to perform the operations. - No longer require your GOROOT to be writeable. - No longer require your GOPATH list to contain no more than 1 workspace. - It has no side-effects, for example, it no longer leaves the $GOPATH/bin/playground.js.map file behind. Fixes #36. It doesn't fix a part of #36, but a new issue #43 is created to track that.
084b4e9
to
84b8935
Compare
Thanks. Squashed and merged as 84b8935. |
This is based on work in #41, which allows this entire step to be done in a matter of seconds by simply running one command: go generate github.com/gopherjs/gopherjs.github.io/playground And it works even with multiple GOPATHs, and non-writeable GOROOT. \o/
It does require Go to be atIt doesn't require Go to be in any hardcoded location./usr/local/go
. This can be improved in the future.It uses a temporary staging folder to perform the operations.
$GOPATH/bin/playground.js.map
file behind.Fixes #36.