Skip to content

Conversation

@hanshal101
Copy link

@hanshal101 hanshal101 commented May 13, 2025

Fixes #137
Closes #137

Description

This PR adds the linting flow in the Github Actions CI.
Also here I have fixed maximum lint errors. But few of them are left, I am a bit confused on how to fix them. Consider fixing before merge.

@davidmdm
Copy link
Collaborator

@hanshal101 Wanted to thank you quickly for this! Will need to take a bit of time to review which I don't have right now, but will try and get some good comments in tonight!

One quick thing, its nice that it runs in CI, however it would be good to have an easy way to run it locally during development. Maybe via using go tool and taskfile!

Signed-off-by: hanshal101 <hanshalmehta10@gmail.com>
@hanshal101
Copy link
Author

Hello @davidmdm I have made the necessary changes here!


json.NewEncoder(w).Encode(&review)
if err := json.NewEncoder(w).Encode(&review); err != nil {
log.Fatalf("error in encoding: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely cannot be fatal. Client connections to our server can dissappear, or there can be other reasons that we might fail to write to any give http.ResponseWriter.
We definitely do not want to crash the program.

I believe we already have a logger in scope

))
json.NewEncoder(w).Encode(review)
if err := json.NewEncoder(w).Encode(review); err != nil {
log.Fatalf("error in encoding: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

func main() {
// This flight needs cross-namespace to be set in order to work and serves to test that feature.
json.NewEncoder(os.Stdout).Encode(flight.Resources{
if err := json.NewEncoder(os.Stdout).Encode(flight.Resources{
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is just testing. If it fails it will get caught in the tests.
Easier to just ignore the error explicitly:

_ = json.NewEncoder(...).Encode(...)


func main() {
json.NewEncoder(os.Stdout).Encode(flight.Resources{
if err := json.NewEncoder(os.Stdout).Encode(flight.Resources{
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

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.

Add Linting in Github Actions CI Pipeline

2 participants