Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ramondeklein committed Nov 25, 2024
1 parent 690c558 commit e8370a2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions cmd/kes/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@ func infoIdentityCmd(args []string) {
cli.Fatal(err)
}
year, month, day := info.CreatedAt.Date()
hour, min, sec := info.CreatedAt.Clock()
hour, minute, sec := info.CreatedAt.Clock()

fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Identity")),
identityStyle.Render(info.Identity.String()),
)
fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Created At")),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, sec),
)
if info.IsAdmin {
fmt.Println(faint.Render(fmt.Sprintf("%-11s", "Role")), "Admin")
Expand All @@ -520,13 +520,13 @@ func infoIdentityCmd(args []string) {
}
if info.Policy != "" {
year, month, day := policy.CreatedAt.Date()
hour, min, sec := policy.CreatedAt.Clock()
hour, minute, sec := policy.CreatedAt.Clock()

fmt.Println()
fmt.Println(faint.Render(fmt.Sprintf("%-11s", "Policy")), policyStyle.Render(info.Policy))
fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Created At")),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, sec),
)
if len(policy.Allow) > 0 {
fmt.Println(faint.Render(fmt.Sprintf("%-11s", "Allow")))
Expand All @@ -547,7 +547,7 @@ func infoIdentityCmd(args []string) {
cli.Fatal(err)
}
year, month, day := info.CreatedAt.Date()
hour, min, sec := info.CreatedAt.Clock()
hour, minute, sec := info.CreatedAt.Clock()

fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Identity")),
Expand All @@ -558,7 +558,7 @@ func infoIdentityCmd(args []string) {
}
fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Created At")),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, sec),
)
if info.IsAdmin {
fmt.Println(faint.Render(fmt.Sprintf("%-11s", "Role")), "Admin")
Expand Down
4 changes: 2 additions & 2 deletions cmd/kes/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ func describeKeyCmd(args []string) {
}

year, month, day := info.CreatedAt.Date()
hour, min, sec := info.CreatedAt.Clock()
hour, minute, sec := info.CreatedAt.Clock()

buf := &strings.Builder{}
fmt.Fprintf(buf, "%-11s %s\n", "Name", info.Name)
fmt.Fprintf(buf, "%-11s %s\n", "Algorithm", info.Algorithm)
fmt.Fprintf(buf, "%-11s %04d-%02d-%02d %02d:%02d:%02d\n", "Date", year, month, day, hour, min, sec)
fmt.Fprintf(buf, "%-11s %04d-%02d-%02d %02d:%02d:%02d\n", "Date", year, month, day, hour, minute, sec)
fmt.Fprintf(buf, "%-11s %s", "Owner", info.CreatedBy)
fmt.Print(buf)
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/kes/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ func printAuditLog(stream *kes.AuditStream) {
for stream.Next() {
event := stream.Event()
var (
hour, min, sec = event.Timestamp.Clock()
status = strconv.Itoa(event.StatusCode)
identity = identityStyle.Render(event.ClientIdentity.String())
apiPath = apiStyle.Render(event.APIPath)
latency = event.ResponseTime
hour, minute, sec = event.Timestamp.Clock()
status = strconv.Itoa(event.StatusCode)
identity = identityStyle.Render(event.ClientIdentity.String())
apiPath = apiStyle.Render(event.APIPath)
latency = event.ResponseTime
)

if event.StatusCode == http.StatusOK {
Expand Down Expand Up @@ -167,7 +167,7 @@ func printAuditLog(stream *kes.AuditStream) {
}
ipAddr = ipStyle.Render(ipAddr)

fmt.Printf(format, hour, min, sec, status, identity, ipAddr, apiPath, latency)
fmt.Printf(format, hour, minute, sec, status, identity, ipAddr, apiPath, latency)
}
if err := stream.Close(); err != nil {
if errors.Is(err, context.Canceled) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/kes/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ func infoPolicyCmd(args []string) {
fmt.Println(faint.Render(fmt.Sprintf("%-11s", "Name")), policyStyle.Render(name))
if !info.CreatedAt.IsZero() {
year, month, day := info.CreatedAt.Local().Date()
hour, min, sec := info.CreatedAt.Local().Clock()
hour, minute, sec := info.CreatedAt.Local().Clock()
fmt.Println(
faint.Render(fmt.Sprintf("%-11s", "Date")),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec),
fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, sec),
)
}
if !info.CreatedBy.IsUnknown() {
Expand Down Expand Up @@ -335,8 +335,8 @@ func showPolicyCmd(args []string) {
header := tui.NewStyle().Bold(true).Foreground(Cyan)
if !policy.CreatedAt.IsZero() {
year, month, day := policy.CreatedAt.Local().Date()
hour, min, sec := policy.CreatedAt.Local().Clock()
fmt.Printf("\n%s %04d-%02d-%02d %02d:%02d:%02d\n", header.Render("Created at:"), year, month, day, hour, min, sec)
hour, minute, sec := policy.CreatedAt.Local().Clock()
fmt.Printf("\n%s %04d-%02d-%02d %02d:%02d:%02d\n", header.Render("Created at:"), year, month, day, hour, minute, sec)
}
if !policy.CreatedBy.IsUnknown() {
fmt.Println(header.Render("Created by:"), policy.CreatedBy)
Expand Down

0 comments on commit e8370a2

Please sign in to comment.