Skip to content

build: add fmt, lint, vulncheck to improve code readability and security#21

Merged
oxtyped merged 1 commit intooxtyped:mainfrom
zhoukuncheng:main
Mar 31, 2024
Merged

build: add fmt, lint, vulncheck to improve code readability and security#21
oxtyped merged 1 commit intooxtyped:mainfrom
zhoukuncheng:main

Conversation

@zhoukuncheng
Copy link
Copy Markdown
Contributor

Thanks to the gpodder2go project, it is compatible with the AntennaPod and gPodder clients very well. However, I found that the project lacked some code check tools, so I added some check targets to the Makefile and fixed issues scanned by these tools.

The main changes include:

  1. Formatting and Linting: Applied gofumpt, goimports, and golangci-lint to ensure consistent code formatting and adherence to best practices.

  2. Vulnerability Scanning: Ran govulncheck to identify and address potential vulnerabilities in the project dependencies.

  3. Dependency Updates: Updated the go.mod and go.sum files to include the latest versions of project dependencies, addressing vulnerabilities scanned by govulncheck.

@oxtyped
Copy link
Copy Markdown
Owner

oxtyped commented Mar 31, 2024

Thanks for this and the clear PR description! 🙇

I don't have any issues with PR and the tools used in general.

Just have one quick question, I noticed that the linter (probably) is removing the explicit returns. I usually purposefully write a return for readability purposes, so this is something quite curious for me. Do you know what might be the rationale behind this removal?

@zhoukuncheng
Copy link
Copy Markdown
Contributor Author

I added the golangci-lint command inspired by the miniflux's Makefile.

Upon running the linter, I received the following warning:

pkg/apis/handlers.go:154:2: S1023: redundant return statement (gosimple)
return
^

The documentation for the S1023 rule recommends removing redundant return:

S1023 - Omit redundant control flow
Functions that have no return value do not need a return statement as the final statement of the function.

Copy link
Copy Markdown
Owner

@oxtyped oxtyped left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reference!

dominikh/go-tools#35

lgtm

@oxtyped oxtyped merged commit 5539795 into oxtyped:main Mar 31, 2024
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.

2 participants