Skip to content

Enable gofmt linter #5630

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

Merged
merged 13 commits into from
Mar 7, 2025
Merged

Enable gofmt linter #5630

merged 13 commits into from
Mar 7, 2025

Conversation

ffjlabo
Copy link
Member

@ffjlabo ffjlabo commented Mar 6, 2025

What this PR does:

as title.

The target files are those below.

% gofmt -s -l ./                                                                            
pkg/app/ops/handler/handler_mock.go
pkg/app/piped/executor/analysis/mannwhitney/udist.go
pkg/app/piped/executor/cloudrun/cloudrun.go
pkg/app/piped/platformprovider/cloudrun/cloudrun.go
pkg/app/pipedv1/livestatereporter/livestatereporter_test.go
pkg/insight/insightstore/deployment_store_test.go
pkg/insight/provider_test.go
pkg/log/log_test.go
tool/actions-gh-release/comment_test.go
tool/actions-gh-release/github.go
tool/actions-gh-release/release_test.go
tool/actions-plan-preview/github.go

Every fix doesn't have any logic changes.

Why we need it:

We can detect some patterns.

  • The codes that are not formatted
  • The codes that have redundant type expressions like those below
	TypeConditions = map[string]struct{}{
-		"Active":              struct{}{},
-		"Ready":               struct{}{},
-		"ConfigurationsReady": struct{}{},
-		"RoutesReady":         struct{}{},
-		"ContainerHealthy":    struct{}{},
-		"ResourcesAvailable":  struct{}{},
-	}
+	TypeConditions = map[string]struct{}{
+		"Active":              {},
+		"Ready":               {},
+		"ConfigurationsReady"  {},
+		"RoutesReady":         {},
+		"ContainerHealthy":    {},
+		"ResourcesAvailable":  {},
+	}

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

ffjlabo added 13 commits March 6, 2025 17:00
Signed-off-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: Yoshiki Fujikane <[email protected]>
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.

Project coverage is 26.65%. Comparing base (424894c) to head (f43e354).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/app/piped/executor/cloudrun/cloudrun.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5630      +/-   ##
==========================================
+ Coverage   26.58%   26.65%   +0.07%     
==========================================
  Files         477      477              
  Lines       50657    50740      +83     
==========================================
+ Hits        13465    13526      +61     
- Misses      36134    36147      +13     
- Partials     1058     1067       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ffjlabo ffjlabo changed the title Add gofmt linter Enable gofmt linter Mar 6, 2025
@@ -1,95 +0,0 @@
// Code generated by MockGen. DO NOT EDIT.
Copy link
Member Author

Choose a reason for hiding this comment

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

The linter warns for this file, but actually this file seems to be not needed.

I noticed the mock for the project store is already created in the pkg/datastore/datastoretest.

@ffjlabo ffjlabo marked this pull request as ready for review March 7, 2025 01:24
Copy link
Member

@Warashi Warashi left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@t-kikuc t-kikuc left a comment

Choose a reason for hiding this comment

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

Great! Thank you!

@t-kikuc t-kikuc merged commit 2f9451d into master Mar 7, 2025
24 of 25 checks passed
@t-kikuc t-kikuc deleted the add-gofmt-linter branch March 7, 2025 01:47
hongky-1994 pushed a commit that referenced this pull request Mar 11, 2025
* Add gofmt linter

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix deployment_store_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/executor/analysis/mannwhitney/udist.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/pipedv1/livestatereporter/livestatereporter_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/insight/provider_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/log/log_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/comment_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/release_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/executor/cloudrun/cloudrun.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/platformprovider/cloudrun/cloudrun.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/github.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-plan-preview/github.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Use datastoretest.MockProjectStore

Signed-off-by: Yoshiki Fujikane <[email protected]>

---------

Signed-off-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: kypham <[email protected]>
khanhtc1202 pushed a commit that referenced this pull request Mar 12, 2025
* Enable `gofmt` linter (#5630)

* Add gofmt linter

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix deployment_store_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/executor/analysis/mannwhitney/udist.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/pipedv1/livestatereporter/livestatereporter_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/insight/provider_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/log/log_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/comment_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/release_test.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/executor/cloudrun/cloudrun.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix pkg/app/piped/platformprovider/cloudrun/cloudrun.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-gh-release/github.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Fix tool/actions-plan-preview/github.go for 'gofmt -s'

Signed-off-by: Yoshiki Fujikane <[email protected]>

* Use datastoretest.MockProjectStore

Signed-off-by: Yoshiki Fujikane <[email protected]>

---------

Signed-off-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: kypham <[email protected]>

* Set default value to depleoyment tracing UI
- Add default title commit
- hide trace.commitMessage when falsy
- hide author when falsy

Signed-off-by: kypham <[email protected]>

* Update default title of commit deployment tracing

Signed-off-by: kypham <[email protected]>

---------

Signed-off-by: Yoshiki Fujikane <[email protected]>
Signed-off-by: kypham <[email protected]>
Co-authored-by: Yoshiki Fujikane <[email protected]>
@github-actions github-actions bot mentioned this pull request Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants