-
Notifications
You must be signed in to change notification settings - Fork 569
Call JsFilesFromDir in the case of 'gopherjs test' as well. #328
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Now that this identifier is exported, it should have a doc string that describes what it does.
Also, according to Go style, the acronym should have the same case, so it's
JSFilesFromDir
, notJsFilesFromDir
.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 don't mind adding a doc string, but the majority of methods in that file don't have any documentation (in fact, the only two I see that are documented aren't even exported), and function name itself is nearly self-documenting.
I also don't mind changing the capitalization of the function, but it's named after the
JsFiles
variable, which is capitalized this way, too.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 guess the Broken windows theory can be adapted to fit software development ;)
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.
We can ask for @neelance's opinion on this.
My understanding is that GopherJS was initially an experimental project, back when it wasn't known if it'd be possible to support of all Go language's features and have good performance, so focusing on implementing functionality over documentation made sense since @neelance was the only developer.
Now that GopherJS has implemented the entire Go spec and has proven to be quite mature, reliable, performant, used in some production environments, and is getting more contributions from external people, I think it's a good idea to start caring about internal code quality, documentation more than in the past.
So I think it's a good idea to apply best practices for the new code being added, and also slowly work on improving existing code. Does that seem like the best way to go, or not?
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.
Without a doubt, @dominikh. And I'm a huge advocate of the continuous improvement model, too, so as I said, I have no problem adding that. And I will add the documentation string when I have a chance, if the PR hasn't already been merged by someone by then.
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.
@shurcooL, valid points, IMO.
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 sort of thing would fit well in a Developers' Guidelines, IMHO... Perhaps I should propose the development and formalization of such a guide in an issue)
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 think we should apply the standards and guidelines of the Go community. If existing code can be improved, we should do so.
JsFiles
should clearly becomeJSFiles
. Some more documentation would also be nice, however in this case I would like to avoid giving the impression that thebuild
package is stable API. It does not feel ready to me. If we add more docs then we should warn in the package description about potential future changes.Speaking of changes, making
jsFilesFromDir
exported seems wrong to me. This is an internal helper, the package should make all necessary cases available via higher-level API. Also adding this code docollectTests
will probably include the.inc.js
files twice.The root cause is bad API of the
build
package.jsFilesFromDir
should probably somehow move into theImport
function and then there should also be anImportDir
function. It also occurred to me thatSession.ImportPackage
is probably a bad name, since it actually builds the package. Seems like I did not do a good job at this part of the codebase and it needs some refactoring to become nice.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.
Good point, agreed.