-
Notifications
You must be signed in to change notification settings - Fork 488
Make commonInitialisms
public
#272
Comments
Hi. You mention that you would like access to |
@dsnet Well, my generator runs the code through GoFmt and produces some pretty decent looking code. The only thing GoLint has ever complained about was the capitalization thing. Not all generated files are going to be human-unreadable. To answer your question, no, I don't think that #239 is the root solution for my problem - it feels like more of a bandaid. Also, this issue isn't a huge deal to me, and I don't imagine it would be to anyone else. It would mostly be a convenience. So I understand this is very low priority 😄 |
@b0o You are actually not alone and I have the exact same use case. I would even go further and ask whether My generator happens to "create" CamelCased names from snake_cased ones (from a different language) and it's very difficult, if not impossible to make The ultimate thing would be to have a function that, given a name, returns one that is idiomatic Go for which |
Indeed, I also needed it for my jsonschema2go library, which generates go types based on json schemas. I ended up duplicating the initialisms, but if it was public, I would not have needed to. |
Thank you for submitting this issue! As per golang/go#38968, we are freezing and deprecating golint. There's no drop-in replacement to golint per se, but you should find that Staticcheck works well in encouraging good Go code, much like golint did in the past, since it also includes style checks. There's always If you would like to contribute further, I'd encourage you to engage Staticcheck's issue tracker or look at vet's open issues, as they are both actively maintained. If you have an idea that doesn't fit into either of those tools, you could look at other Go linters, or write your own - these days it's fairly straightforward with go/analysis. To help avoid confusion, I'm closing all issues before we freeze the repository. If you have any feedback, you can leave a comment on the proposal thread where it was decided to deprecate golint - though note that the proposal has been accepted for nearly a year. Thanks! |
This would be useful for cases where code is being generated automatically, e.g. using
go generate ...
.I'm generating funcs/types/methods based on a YAML file; one of my type names is "sql" - It needs to be lowercase in my YAML file because some of the generated code is private, and I need to support other type names which are camelCase - I modify the case automatically.
Thus, in order to comply with
golint
, I need to check the first part of each string against thecommonInitialisms
map (currently located at lint.go:731).At the moment, I need to hardcode a copy of the
commonInitialisms
map and hope that it doesn't change in this repo. :)The text was updated successfully, but these errors were encountered: