Skip to content

Commit

Permalink
Run go fmt ./...
Browse files Browse the repository at this point in the history
Looks like newer Go version have a different opinion on how indentation in
comments should look like. Adapt existing comments to make the GitHub Actions
happy.
  • Loading branch information
julianbrost committed Aug 4, 2023
1 parent ab42fab commit 9c2dcd2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions pkg/icingadb/v1/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func (e *Environment) Meta() *EnvironmentMeta {

// EnvironmentFromContext returns the Environment value stored in ctx, if any:
//
// e, ok := EnvironmentFromContext(ctx)
// if !ok {
// // Error handling.
// }
// e, ok := EnvironmentFromContext(ctx)
// if !ok {
// // Error handling.
// }
func EnvironmentFromContext(ctx context.Context) (*Environment, bool) {
if e, ok := ctx.Value(environmentContextKey).(*Environment); ok {
return e, true
Expand Down
32 changes: 16 additions & 16 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ func Key(name string, sep byte) string {
//
// Timed should be installed by defer:
//
// func TimedExample(logger *zap.SugaredLogger) {
// defer utils.Timed(time.Now(), func(elapsed time.Duration) {
// logger.Debugf("Executed job in %s", elapsed)
// })
// job()
// }
// func TimedExample(logger *zap.SugaredLogger) {
// defer utils.Timed(time.Now(), func(elapsed time.Duration) {
// logger.Debugf("Executed job in %s", elapsed)
// })
// job()
// }
func Timed(start time.Time, callback func(elapsed time.Duration)) {
callback(time.Since(start))
}
Expand Down Expand Up @@ -158,20 +158,20 @@ func Ellipsize(s string, limit int) string {
//
// Example usage:
//
// # snake_case
// ConvertCamelCase(s, unicode.Lower, '_')
// # snake_case
// ConvertCamelCase(s, unicode.Lower, '_')
//
// # SCREAMING_SNAKE_CASE
// ConvertCamelCase(s, unicode.Upper, '_')
// # SCREAMING_SNAKE_CASE
// ConvertCamelCase(s, unicode.Upper, '_')
//
// # kebab-case
// ConvertCamelCase(s, unicode.Lower, '-')
// # kebab-case
// ConvertCamelCase(s, unicode.Lower, '-')
//
// # SCREAMING-KEBAB-CASE
// ConvertCamelCase(s, unicode.Upper, '-')
// # SCREAMING-KEBAB-CASE
// ConvertCamelCase(s, unicode.Upper, '-')
//
// # other.separator
// ConvertCamelCase(s, unicode.Lower, '.')
// # other.separator
// ConvertCamelCase(s, unicode.Lower, '.')
func ConvertCamelCase(s string, _case int, sep byte) string {
r := []rune(s)
b := strings.Builder{}
Expand Down
8 changes: 4 additions & 4 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ type VersionInfo struct {
}

// Version determines version and commit information based on multiple data sources:
// - Version information dynamically added by `git archive` in the remaining to parameters.
// - A hardcoded version number passed as first parameter.
// - Commit information added to the binary by `go build`.
// - Version information dynamically added by `git archive` in the remaining to parameters.
// - A hardcoded version number passed as first parameter.
// - Commit information added to the binary by `go build`.
//
// It's supposed to be called like this in combination with setting the `export-subst` attribute for the corresponding
// file in .gitattributes:
//
// var Version = version.Version("1.0.0-rc2", "$Format:%(describe)$", "$Format:%H$")
// var Version = version.Version("1.0.0-rc2", "$Format:%(describe)$", "$Format:%H$")
//
// When exported using `git archive`, the placeholders are replaced in the file and this version information is
// preferred. Otherwise the hardcoded version is used and augmented with commit information from the build metadata.
Expand Down

0 comments on commit 9c2dcd2

Please sign in to comment.