chore: execute goimports to format the code#740
chore: execute goimports to format the code#740xibeiyoumian wants to merge 1 commit intors:masterfrom
Conversation
Signed-off-by: xibeiyoumian <xibeiyoumian@outlook.com>
|
Please check failed tests |
There was a problem hiding this comment.
Pull request overview
This PR updates build constraints across multiple Go files to use the modern //go:build directive format (introduced in Go 1.17) while maintaining backward compatibility with the legacy // +build format. The changes also include minor formatting improvements such as adding blank lines between imports and removing extraneous blank lines from comments.
Key Changes
- Added
//go:builddirectives to all files that previously only had legacy// +buildconstraints - Standardized the format of build constraints to use
&&syntax instead of multiple separate lines - Added blank line separation in import blocks per Go formatting conventions
Reviewed changes
Copilot reviewed 14 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| syslog_test.go | Updated build constraints from separate lines to combined //go:build format |
| syslog.go | Updated build constraints from separate lines to combined //go:build format |
| pkgerrors/stacktrace_test.go | Added //go:build directive for binary_log constraint |
| not_go112.go | Added //go:build directive for go version constraint |
| log_example_test.go | Added //go:build directive for binary_log constraint |
| journald/journald_test.go | Added //go:build directive for linux platform constraint |
| internal/cbor/types_64_test.go | Added //go:build directive for architecture constraint |
| hlog/hlog_example_test.go | Added //go:build directive for binary_log constraint |
| go112.go | Added //go:build directive for go version constraint |
| event_test.go | Added //go:build directive for binary_log constraint |
| encoder_json.go | Added //go:build directive and blank line in imports |
| encoder_cbor.go | Added //go:build directive for binary_log constraint |
| diode/diode_example_test.go | Added //go:build directive for binary_log constraint |
| ctx.go | Removed trailing blank line from comment block |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // +build !binary_log | ||
| // +build !windows | ||
| //go:build !binary_log && !windows | ||
| // +build !binary_log,!windows |
There was a problem hiding this comment.
The legacy build constraint uses commas between conditions, which means OR in legacy syntax, but the new //go:build directive uses && for AND. These should match - use // +build !binary_log and // +build !windows on separate lines to match the AND logic of the //go:build directive.
| // +build !binary_log,!windows | |
| // +build !binary_log | |
| // +build !windows |
| // +build !windows | ||
| // +build !binary_log | ||
| //go:build !windows && !binary_log | ||
| // +build !windows,!binary_log |
There was a problem hiding this comment.
The legacy build constraint uses commas between conditions, which means OR in legacy syntax, but the new //go:build directive uses && for AND. These should match - use // +build !windows and // +build !binary_log on separate lines to match the AND logic of the //go:build directive.
| // +build !windows,!binary_log | |
| // +build !windows | |
| // +build !binary_log |
execute goimports to format the code