Skip to content

GopherJS writes to GOPATH workspace when doing build. #61

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
dmitshur opened this issue Jun 26, 2014 · 3 comments
Closed

GopherJS writes to GOPATH workspace when doing build. #61

dmitshur opened this issue Jun 26, 2014 · 3 comments

Comments

@dmitshur
Copy link
Member

It seems the CLI interface tries to mimic the go command. But it has an unexpected difference. The go command only writes stuff to your $GOPATH/pkg when you do go install, but it uses temporary folders when you do go build.

Using gopherjs build seems to write to my $GOPATH/pkg every time.

@neelance
Copy link
Member

Yes, this difference is on purpose.

The core packages of normal Go in GOROOT are already compiled when you install it, so go build only has to compile the packages in GOPATH and most likely you got all 3rd party libraries with go get, so they are also already compiled. This means that go build has very little to do and is fast.

GopherJS on the other hand has to compile everything. Most users will use gopherjs build a lot for building scripts for their sites. I want this to be fast. In the past I had a warning message that you had to run gopherjs install -all once to make gopherjs build fast, but at some point I decided that this is cumbersome (you have to repeat this every time you update GopherJS), so I simply dropped the -all flag and made go build save package archives to GOPATH for reuse on next go build.

Do you see a downside in this behaviour?

@dmitshur
Copy link
Member Author

I see now that you try to install the core packages (i.e., from GOROOT). I thought it was installing the actual package you're building too.

This was primarily a problem because of the other issue #60. Once that's fixed, this behavior may be okay as is.

In the past I had a warning message that you had to run gopherjs install -all once to make gopherjs build fast, but at some point I decided that this is cumbersome (you have to repeat this every time you update GopherJS), so I simply dropped the -all flag and made go build save package archives to GOPATH for reuse on next go build.

How do you find out whether the existing files need to be updated (e.g., because of a newer GopherJS version) or can be safely reused instead?

@neelance
Copy link
Member

Timestamps. See build.BuildPackage.

@neelance neelance closed this as completed Jul 5, 2014
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

No branches or pull requests

2 participants