Skip to content

gopherjs serve: Fix precedence of served files. #257

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

Merged
merged 2 commits into from
Jul 15, 2015
Merged

gopherjs serve: Fix precedence of served files. #257

merged 2 commits into from
Jul 15, 2015

Conversation

dmitshur
Copy link
Member

Previously, if there was already a {base}.js file on disk (possibly as a result of running gopherjs build in the past), it would take higher precedence than the freshly compiled {base}.js file. Fix that by rearranging the serving precedence logic as follows:

  1. {base}.js && valid Go command in folder -> compiled {base}.js
  2. {base}.js.map && valid Go command in folder -> compiled {base}.js.map
  3. Look in all Go workspaces (GOPATH and GOROOT)
  4. index.html && valid Go command in folder -> our own stub index.html

This way, if there's an index.html file on disk, it takes higher precedence, but not {base}.js and {base}.js.map files.

Needed for gopherjs/gopherjs.github.io#25.

dmitshur added 2 commits July 15, 2015 00:27
Previously, if there was already a {base}.js file on disk (possibly as
a result of running `gopherjs build` in the past), it would take higher
precedence than the freshly compiled {base}.js file. Fix that by
rearranging the serving precedence logic as follows:

1. {base}.js && valid Go command in folder -> compiled {base}.js
2. {base}.js.map && valid Go command in folder -> compiled {base}.js.map
3. Look in all Go workspaces (GOPATH and GOROOT)
4. index.html && valid Go command in folder -> our own stub index.html

This way, if there's an index.html file on disk, it takes higher
precedence, but not {base}.js and {base}.js.map files.
neelance added a commit that referenced this pull request Jul 15, 2015
gopherjs serve: Fix precedence of served files.
@neelance neelance merged commit 13d7ae2 into gopherjs:master Jul 15, 2015
@dmitshur dmitshur deleted the gopherjs-serve-precedence-fix branch July 15, 2015 21:28
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