-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Correcting go.mod and go.sum to generated files instead of AMPL. #4306
Conversation
To save you time: we don't need a heuristic for explicitly named files. The analysis will never get to the heuristic 😄 |
Oh, even easier 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.
Thanks for your contribution!
I've left two comments to address inline 👇
Adding the samples broke the tests so I've moved them to the right location now. |
@pchaigno is there a way to "unlanguage" a certain file then? If it's not necessarily Go (since it's not), is there a way for us to say that it's not anything else as well? |
There's not. It's a known limitation of Linguist which we've discussed several times, but haven't found the time to address. Maybe we can address this another way: Are these files generated or are they written by humans? Are |
They're "generated" files, and rarely (but not never) edited by humans - specifically, they're generated by the Go binary, using The closest analogy is probably to JavaScript's I had a look at the code in |
Maybe we should add them to
Yes, it means they won't show up in diffs across GitHub.com (PRs, branch comparisons, etc.). That won't affect the |
The main (only?) thing I was trying to do was just to stop repos and statistics showing AMPL as a language in that upper bar. I think switching to generated would cover that from what you've mentioned, which would be great - I should be able to make those changes and push a new update. |
Do you want the explicit "filenames" section removed from the language specification? From my understanding that is not required if it's generated? The samples are used in the tests so I've left them in (but can remove them if needed). Thanks for the help! 👍 |
I'd rather we remove them.
If we remove the filenames in |
Changes were made, but the Travis build is still going at 30 minutes... checking all the builds shows that Travis thinks they all passed ( |
Looks like a bug in Travis CI (maybe due to the Daylight saving time change in Europe). I tried to restart the builds but there seems to be the same problem again. I'll try again this evening or tomorrow if it doesn't resolve itself in the meantime. |
Finally passed now! 🎉 |
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.
LGTM!
@leighlondon Thanks for your contribution and your patience!
Thanks for the help and being so patient with me @pchaigno 😄 |
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.
LGTM Thanks for the contribution and welcome to Linguist.
@leighlondon @pchaigno - changes to The fact that Changes to |
I very much agree with @myitcv - even if one should never edit |
@lildude Should we revert this? How did we handle this kind of issues in the past? |
If the general consensus from the Go community is that these should not be marked as generated and thus should be reviewed, then lets (@pchaigno, @Alhadis or me) go ahead and click the Revert button. If we could get some referenceable guidelines, that would be an added bonus so we can avoid a debate about this in future. |
You could have a look at https://github.com/golang/go/wiki/Modules#gomod or https://github.com/golang/go/wiki/Modules#faqs--gomod-and-gosum. There's no specific entry in the FAQ about whether these files should be hidden during code reviews. But no part of the document says that they should be ignored or treated like generated files. |
@lildude I'm afraid I don't have the revert button. |
Just to add to @mvdan's comments, I would also suggest that a question to https://groups.google.com/forum/#!forum/golang-nuts would also be an excellent way of getting an "official" answer. |
@lildude - please can we get an update on this? |
@myitcv sorry, I'm not had a chance to do anything remotely Linguist-based this week and not sure I'll have the time next week. I'd really appreciate it if you could pose this question to the golang-nuts forum to get an idea of which way peeps prefer things - keep as generated or show in diff, both of which can easily be overridden within .gitattributes. |
@lildude - there is already a convention for indicating Go-related files are generated: https://golang.org/s/generatedcode Add that to the comments above and the wiki link, I don't think this is case of what default people prefer. By default, As you say, if people prefer something other than the default (which I can't quite comprehend, because that would mean they prefer not to see changes in the (transitive) dependencies of their projects) they can easily do so. cc @bcmills from the Go team in case there is anything to add/amend to the above. |
Ah, that's interesting and very useful. Thanks @myitcv. I think we can definitely rely on that as an indicator these files shouldn't be marked as generated (yet) as Go isn't adding the standard text to indicate they should be.
Update: ignore that. Named file entries would need to added too. I've got a few free mins now so will do it now. |
* Revert "Treat go.mod and go.sum as generated files. (#4306)" This reverts commit ba0c5e9. * Add go.mod and go.sum to Text * Add test files to fixtures Files taken from https://github.com/golang/oauth2/ licensed under BSD 3-clause license * Add test to prevent addition of samples
Correcting go.mod and go.sum to Go.
Description
Go's new "modules" feature uses some additional filenames -
go.mod
andgo.sum
. Thego.mod
file is misclassified as "AMPL" due to fallthrough in the heuristics.I've added a new
go.mod
sample file and adjusted the heuristics to try get these module files classified as Go.Checklist:
I am associating a language with a new file extension.
I am adding a new language.
I am fixing a misclassified language
I am changing the source of a syntax highlighting grammar
I am updating a grammar submodule
I am adding new or changing current functionality