Skip to content

Linter configuration#9

Merged
mishankov merged 24 commits into
mainfrom
lint
Oct 26, 2025
Merged

Linter configuration#9
mishankov merged 24 commits into
mainfrom
lint

Conversation

@mishankov
Copy link
Copy Markdown
Member

No description provided.

This was linked to issues Oct 25, 2025
- Add godox and gosec linters to golangci configuration
- Improve HTTP server security by adding ReadHeaderTimeout
- Enhance file permission security in code generation:
  - Change directory permissions from 0755 to 0750
  - Change file permissions from 0644 to 0600
  - Add path cleaning for template paths to prevent directory traversal
The filepath.Clean call was redundant since the template path is constructed using filepath.Join which already handles path normalization. Additionally, added a gosec linter exception comment since the template path is known at compile time and safe.
- Add makezero linter to detect zero-length slice declarations
- Add mirror linter for code consistency improvements
- Refactor test code to use WriteString instead of Write with byte slice conversion
- Add musttag, nestif, nilerr, nilnesserr, and nilnil linters to golangci configuration
- Refactor authentication middleware to properly handle user not found errors
- Replace nil user check with explicit ErrUserNotFound error handling in service layer
- Improve error response consistency in authentication flow
Add nil check before closing response body in test defer function to prevent potential nil pointer dereference when response body is nil.
fix(httpclient): add nil check for response body in test
- Add 'paralleltest' linter to golangci configuration to enforce parallel test usage
- Add t.Parallel() to all test functions in auth, httpclient, and httpserver packages
- Remove unnecessary response body cleanup in httpclient error test case
- Enable parallel execution for improved test performance and better resource utilization
- Standardize struct tag ordering in User and Session structs to have db tags before json tags
- Add staticcheck and tagalign linters to golangci configuration
- Update linter configuration comments for better maintainability
- Add tagliatelle, testableexamples, testpackage, thelper, tparallel, unconvert, unparam, unused, and usestdlibvars linters to golangci configuration
- Configure tagliatelle to enforce camelCase for JSON tags
- Replace string literals with http.Method constants in test files for improved code quality and consistency
- Update HTTP method usage in auth middleware and httpclient tests to use standard library constants
- Add usetesting, wastedassign, and wrapcheck linters to golangci configuration
- Enhance error handling across multiple packages by wrapping errors with context
- Improve error messages in auth, database, httpclient, httpserver, scheduler, and session packages
- Ensure consistent error wrapping pattern throughout the codebase
@mishankov mishankov merged commit 8bc059e into main Oct 26, 2025
4 checks passed
@mishankov mishankov deleted the lint branch October 26, 2025 09:43
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.

Create first version of golangci-lint config file Fix linter errors

1 participant