Skip to content

Commit

Permalink
skip linting additional test files
Browse files Browse the repository at this point in the history
Signed-off-by: Pranay Valson <[email protected]>
  • Loading branch information
noslav committed Jan 2, 2025
1 parent 4956f6b commit cd163e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
run:
timeout: 5m
modules-download-mode: readonly
skip-files:
- "internal/config/utils_test.go"
skip-dirs:
- internal/metrics
- bin/
Expand Down
10 changes: 9 additions & 1 deletion internal/config/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,39 @@ import (
// LookupEnvOrString looks up a flag env that is a string
func LookupEnvOrString(key string, defaultVal string) string {
if val, ok := os.LookupEnv(key); ok {

Check failure on line 11 in internal/config/utils.go

View workflow job for this annotation

GitHub Actions / go-lint

unnecessary leading newline (whitespace)

return val
}

return defaultVal
}

// LookupEnvOrInt looks up a flag env that is an integer and returns its value.
// If the environment variable is not set, it returns the default value.
func LookupEnvOrInt(key string, defaultVal int) int {
if val, ok := os.LookupEnv(key); ok {
v, err := strconv.Atoi(val)
if err != nil {
panic(fmt.Sprintf("unable to lookupEnvOrInt[%s]: %v", key, err))
}

return v
}

return defaultVal
}

// LookupEnvOrInt64 looks up a flag env that is an integer
// LookupEnvOrInt64 looks up a flag env that is an integer and returns its value as int64.
// If the environment variable is not set, it returns the default value.
func LookupEnvOrInt64(key string, defaultVal int64) int64 {
if val, ok := os.LookupEnv(key); ok {
v, err := strconv.ParseInt(val, 10, 64)
if err != nil {
panic(fmt.Sprintf("unable to lookupEnvOrInt64[%s]: %v", key, err))
}

return v
}

return defaultVal
}

0 comments on commit cd163e3

Please sign in to comment.