Skip to content

Commit

Permalink
style: format code with Gofumpt and Prettier
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 1a6c9b1 according to the output
from Gofumpt and Prettier.

Details: #2579
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
deepsource-autofix[bot] authored and kpango committed Sep 1, 2024
1 parent 1a6c9b1 commit 1b5803e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 22 deletions.
52 changes: 38 additions & 14 deletions internal/log/level/level.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,44 @@ func (l Level) String() string {
}

func Atol(str string) Level {
str = strings.ToUpper(str)
for i := len(str); i > 0; i-- {
switch str[:i] {
case DEBUG.String(), "DEB", "DEBG", "DB", "DBG", "D":
return DEBUG
case INFO.String(), "IFO", "INF", "IF", "IN", "I":
return INFO
case WARN.String(), "WARNING", "WAR", "WRN", "WN", "W":
return WARN
case ERROR.String(), "ERROR", "ERRO", "ER", "ERR", "E":
return ERROR
case FATAL.String(), "FATA", "FAT", "FT", "FL", "F":
return FATAL
}
l, ok := map[string]Level{
DEBUG.String(): DEBUG,
DEBUG.String() + "S": DEBUG,
"D": DEBUG,
"DB": DEBUG,
"DBG": DEBUG,
"DEB": DEBUG,
"DEBG": DEBUG,
INFO.String(): INFO,
INFO.String() + "S": INFO,
"I": INFO,
"IF": INFO,
"IFO": INFO,
"IN": INFO,
"INF": INFO,
WARN.String(): WARN,
WARN.String() + "S": WARN,
"W": WARN,
"WAR": WARN,
"WARNING": WARN,
"WN": WARN,
"WRN": WARN,
ERROR.String(): ERROR,
ERROR.String() + "S": ERROR,
"E": ERROR,
"ER": ERROR,
"ERR": ERROR,
"ERRO": ERROR,
FATAL.String(): FATAL,
FATAL.String() + "S": FATAL,
"F": FATAL,
"FAT": FATAL,
"FATA": FATAL,
"FL": FATAL,
"FT": FATAL,
}[strings.ToUpper(str)]
if ok {
return l
}
return Unknown
}
12 changes: 6 additions & 6 deletions pkg/agent/internal/vqueue/stateful_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.IVExists(idA)
_, exists := q.IVExists(idA)
return &resultContainer{
exists: exists,
}
Expand Down Expand Up @@ -439,7 +439,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.IVExists(idB)
_, exists := q.IVExists(idB)
return &resultContainer{
exists: exists,
}
Expand Down Expand Up @@ -490,7 +490,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.IVExists(idC)
_, exists := q.IVExists(idC)
return &resultContainer{
exists: exists,
}
Expand Down Expand Up @@ -541,7 +541,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.DVExists(idA)
_, exists := q.DVExists(idA)
return &resultContainer{
exists: exists,
}
Expand Down Expand Up @@ -592,7 +592,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.DVExists(idB)
_, exists := q.DVExists(idB)
return &resultContainer{
exists: exists,
}
Expand Down Expand Up @@ -643,7 +643,7 @@ var (
sy := systemUnderTest.(*qSystem)
q := sy.q

exists := q.DVExists(idC)
_, exists := q.DVExists(idC)
return &resultContainer{
exists: exists,
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/index/job/correction/service/corrector.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ func (c *correct) correctTimestamp(
) (any, error) {
client := vc.NewValdClient(conn)
_, err := client.UpdateTimestamp(ctx, &payload.Update_TimestampRequest{
Id: latestObject.GetId(),
Timestamp: latestObject.GetTimestamp(),
Id: latestObject.GetId(),
Timestamp: latestObject.GetTimestamp(),
}, copts...)
if err != nil {
if st, ok := status.FromError(err); !ok || st == nil {
Expand Down

0 comments on commit 1b5803e

Please sign in to comment.