英文:
is it possible to override the automatic formatter in go
问题
在一个GO结构体中,我个人不喜欢按照约定将id字段命名为UserID。有没有办法告诉GO格式化程序,UserId是可以接受的,不要再给我警告了?
英文:
In a GO struct I personally do not like the id fields following the convension - UserID. Is there a way to tell the GO formatter that UserId is ok and to stop giving me a warning?
答案1
得分: 6
只需fork golint
仓库并根据您的喜好修改 lintNames
函数即可:https://github.com/golang/lint/blob/32a87160691b3c96046c0c678fe57c5bef761456/lint.go#L510
我的建议是:不要覆盖惯例,否则您的代码将对其他Gopher来说显得陌生!
英文:
Just fork the golint
repo and modify the lintNames
function as you like: https://github.com/golang/lint/blob/32a87160691b3c96046c0c678fe57c5bef761456/lint.go#L510
My suggestion: Don't override conventions or your code will look alien to other Gophers!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论