Skip to content
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

解決go lint上顯示的warning,包含縮寫及error命名、一致的receiver命名等 #54

Merged
merged 12 commits into from
Mar 6, 2021

Conversation

titaneric
Copy link
Collaborator

@titaneric titaneric commented Feb 27, 2021

👏 解決掉的 issue / Resolved Issues

⛏ 變更內容 / Details of Changes

  • 縮寫命名
    • JSON
    • UI
    • ID
  • 一致的receiver命名
  • Error命名
  • increment (E.g., idx++)
  • unreachable code
  • typo
  • PosOf省略bbs名稱

@titaneric titaneric marked this pull request as ready for review March 4, 2021 10:33
@titaneric
Copy link
Collaborator Author

準備可以review了,但CI好像有go build的問題要幫忙看一下

@minchao
Copy link
Contributor

minchao commented Mar 4, 2021

@titaneric CI 裡的問題是 #37#58 (comment) 提到的 module declare,注意到 development 分支在剛剛已經修正了。

@PichuChen
Copy link
Member

可以再幫我 pull 一次 development 嗎?

@minchao
Copy link
Contributor

minchao commented Mar 4, 2021

簡單在 merge current development 後的版本,透過 golangci-lint 跑 golint,發現幾個漏網之魚,提供參考:

$ golangci-lint run
cache/systemvshm.go:50:2: var `shmId` should be `shmID` (golint)
	shmId, err := Shmget(key, size, flag)
	^
cache/systemvshm.go:95:2: var `shmId` should be `shmID` (golint)
	shmId, err := Shmget(key, 0, 0)
	^
cache/systemvshm.go:112:1: receiver name m should be consistent with previous receiver name s for SHM (golint)
func (m *SHM) Close() error {
^
pttbbs/board.go:69:23: method BoardId should be BoardID (golint)
func (b *BoardHeader) BoardId() string            { return b.BoardID() }
                      ^
pttbbs/cache.go:14:2: struct field `posOfUserId` should be `posOfUserID` (golint)
	posOfUserId     int
	^
pttbbs/cache.go:297:17: method UserId should be UserID (golint)
func (c *Cache) UserId(uid int) string {
                ^

@titaneric
Copy link
Collaborator Author

感謝 @minchao@PichuChen ,目前CI過囉,再麻煩幫忙review

@minchao
Copy link
Contributor

minchao commented Mar 4, 2021

@titaneric 剩下最後一個 receiver 修改就過 lint 囉

% golangci-lint run
cache/systemvshm.go:112:1: receiver name m should be consistent with previous receiver name s for SHM (golint)
func (m *SHM) Close() error {
^

@PichuChen PichuChen merged commit 0164cc4 into Ptt-official-app:development Mar 6, 2021
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.

[建議] 支援更好的命名及一致的coding style [主線] [PTT] 將 Id 改為 ID
3 participants