Skip to content

Commit a1f0da8

Browse files
brtkwrclaude
andcommitted
style: gofmt -s simplifications
drops the goreportcard warnings, no behaviour change. mostly composite literal type elisions and slice/range simplifications. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent aa34fc0 commit a1f0da8

8 files changed

Lines changed: 49 additions & 47 deletions

File tree

cmd/zeltapp/cache_cmd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ func cacheListCmd() *cobra.Command {
5151
expiry = remaining.Round(time.Second).String()
5252
}
5353
rows = append(rows, map[string]any{
54-
"path": entry.Path,
55-
"storedAt": entry.StoredAt.Format(time.RFC3339),
56-
"expiresIn": expiry,
57-
"size": len(entry.Body),
54+
"path": entry.Path,
55+
"storedAt": entry.StoredAt.Format(time.RFC3339),
56+
"expiresIn": expiry,
57+
"size": len(entry.Body),
5858
})
5959
}
6060
if len(rows) == 0 {

cmd/zeltapp/client.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ func (s *fileStore) ClearSession() error {
9494
}
9595

9696
// loadSession / saveSession / clearSession compat shims used by older command files.
97-
func loadSession() (*session, error) { return defaultStore().LoadSession() }
98-
func saveSession(s *session) error { return defaultStore().SaveSession(s) }
99-
func clearSession() error { return defaultStore().ClearSession() }
100-
func sessionPath() string { return defaultStore().sessionPath() }
97+
func loadSession() (*session, error) { return defaultStore().LoadSession() }
98+
func saveSession(s *session) error { return defaultStore().SaveSession(s) }
99+
func clearSession() error { return defaultStore().ClearSession() }
100+
func sessionPath() string { return defaultStore().sessionPath() }
101101

102102
type client struct {
103103
http *http.Client
@@ -112,11 +112,11 @@ type client struct {
112112

113113
type clientOpt func(*client)
114114

115-
func withBaseURL(u string) clientOpt { return func(c *client) { c.baseURL = u } }
116-
func withHTTP(h *http.Client) clientOpt { return func(c *client) { c.http = h } }
117-
func withStore(s store) clientOpt { return func(c *client) { c.store = s } }
118-
func withNow(f func() time.Time) clientOpt { return func(c *client) { c.now = f } }
119-
func withVerbose(v bool) clientOpt { return func(c *client) { c.verbose = v } }
115+
func withBaseURL(u string) clientOpt { return func(c *client) { c.baseURL = u } }
116+
func withHTTP(h *http.Client) clientOpt { return func(c *client) { c.http = h } }
117+
func withStore(s store) clientOpt { return func(c *client) { c.store = s } }
118+
func withNow(f func() time.Time) clientOpt { return func(c *client) { c.now = f } }
119+
func withVerbose(v bool) clientOpt { return func(c *client) { c.verbose = v } }
120120

121121
func newClient(opts ...clientOpt) (*client, error) {
122122
jar, err := cookiejar.New(nil)

cmd/zeltapp/client_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ func TestClient_DoSendsJSONBody(t *testing.T) {
4242
st.jsonRoute("POST", "/apiv2/test", 201, []byte(`{"ok":true}`))
4343
c, _ := newAuthedTestClient(t, srv)
4444

45-
type req struct{ X int `json:"x"` }
45+
type req struct {
46+
X int `json:"x"`
47+
}
4648
if err := c.do("POST", "/apiv2/test", req{X: 42}, nil); err != nil {
4749
t.Fatal(err)
4850
}

cmd/zeltapp/leave.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ type balanceResp struct {
2828
}
2929

3030
type bookResp struct {
31-
Success bool `json:"success"`
32-
Method string `json:"method"`
33-
NoOfCreatedAbsences int `json:"noOfCreatedAbsences"`
34-
SkippedUsers []json.RawMessage `json:"skippedUsers"`
31+
Success bool `json:"success"`
32+
Method string `json:"method"`
33+
NoOfCreatedAbsences int `json:"noOfCreatedAbsences"`
34+
SkippedUsers []json.RawMessage `json:"skippedUsers"`
3535
}
3636

3737
func leaveCmd() *cobra.Command {
@@ -205,7 +205,7 @@ func addBookFlags(cmd *cobra.Command, policy *int, start, end, notes *string, mo
205205
func runDryRun(c *client, policy int, start, end, notes string, morning, afternoon, alsoBalance bool) error {
206206
overlapReq := map[string]any{
207207
"absenceStart": start, "absenceEnd": nilIfEmpty(end), "absenceId": nil,
208-
"userIds": []int{c.session.UserID},
208+
"userIds": []int{c.session.UserID},
209209
"morningOnly": morning, "afternoonOnly": afternoon,
210210
"startHour": nil, "endHour": nil,
211211
}

cmd/zeltapp/leave_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func TestLeave_VerifyOverlapBodyShape(t *testing.T) {
162162

163163
overlapReq := map[string]any{
164164
"absenceStart": "2030-06-01", "absenceEnd": nil, "absenceId": nil,
165-
"userIds": []int{c.session.UserID},
165+
"userIds": []int{c.session.UserID},
166166
"morningOnly": false, "afternoonOnly": false,
167167
"startHour": nil, "endHour": nil,
168168
}

cmd/zeltapp/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ var (
2525

2626
func main() {
2727
root := &cobra.Command{
28-
Use: "zeltapp",
29-
Short: "Unofficial CLI for the Zelt HR platform",
30-
Long: "zeltapp talks to https://go.zelt.app/apiv2/* using a cookie session.\nRun `zeltapp login` first.",
31-
Version: version,
28+
Use: "zeltapp",
29+
Short: "Unofficial CLI for the Zelt HR platform",
30+
Long: "zeltapp talks to https://go.zelt.app/apiv2/* using a cookie session.\nRun `zeltapp login` first.",
31+
Version: version,
3232
SilenceUsage: true,
3333
SilenceErrors: true, // we render errors ourselves below
3434
}

cmd/zeltapp/people.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ func toPresentable(arr []peopleCacheEntry) []any {
246246
out := make([]any, 0, len(arr))
247247
for _, p := range arr {
248248
row := map[string]any{
249-
"userId": p.UserID,
250-
"name": p.DisplayName,
251-
"email": p.EmailAddress,
252-
"jobPosition": p.JobPosition,
253-
"department": p.Department,
249+
"userId": p.UserID,
250+
"name": p.DisplayName,
251+
"email": p.EmailAddress,
252+
"jobPosition": p.JobPosition,
253+
"department": p.Department,
254254
}
255255
if row["name"] == "" {
256256
row["name"] = strings.TrimSpace(p.FirstName + " " + p.LastName)

cmd/zeltapp/testutil_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ var fixtureAuthMe = mustJSON(map[string]any{
101101
"company": map[string]any{
102102
"companyId": fakeCompanyID, "name": "Example Co", "slug": "example-co",
103103
},
104-
"mfaType": "email",
105-
"language": "en",
106-
"currency": "GBP",
104+
"mfaType": "email",
105+
"language": "en",
106+
"currency": "GBP",
107107
"contractType": "Payrolled",
108108
"scopes2": []map[string]string{{"scope": "user"}, {"scope": "absence"}},
109109
},
110-
"isSuperAdmin": false,
110+
"isSuperAdmin": false,
111111
"hasUnpaidInvoices": false,
112-
"publicURL": "https://go.zelt.app/files",
112+
"publicURL": "https://go.zelt.app/files",
113113
})
114114

115115
var fixtureLoginStep1 = mustJSON(map[string]any{"mfaType": "email"})
@@ -123,9 +123,9 @@ var fixtureLoginStep2 = mustJSON(map[string]any{
123123

124124
// fixtureAbsenceVerifyOverlap mirrors /apiv2/absences/verify-overlap.
125125
var fixtureAbsenceVerifyOverlap = mustJSON(map[string]any{
126-
"isOverlapping": false,
127-
"absences": []any{},
128-
"events": []any{},
126+
"isOverlapping": false,
127+
"absences": []any{},
128+
"events": []any{},
129129
"preventOwnOverlaps": true,
130130
})
131131

@@ -152,10 +152,10 @@ var fixtureRequestValueBalance = mustJSON(map[string]any{
152152
})
153153

154154
var fixtureBookSuccess = mustJSON(map[string]any{
155-
"success": true,
156-
"method": "direct",
155+
"success": true,
156+
"method": "direct",
157157
"noOfCreatedAbsences": 1,
158-
"skippedUsers": []any{},
158+
"skippedUsers": []any{},
159159
})
160160

161161
var fixtureLeaveDays = mustJSON(map[string]any{
@@ -176,9 +176,9 @@ var fixtureAttendanceWidget = mustJSON(map[string]any{
176176
})
177177

178178
var fixtureCalendar = mustJSON(map[string]any{
179-
"users": []any{},
180-
"days": []any{},
181-
"totals": map[string]int{"absences": 0, "events": 0},
179+
"users": []any{},
180+
"days": []any{},
181+
"totals": map[string]int{"absences": 0, "events": 0},
182182
})
183183

184184
var fixtureExpenses = mustJSON(map[string]any{
@@ -211,10 +211,10 @@ type recordedRequest struct {
211211
type routeHandler func(w http.ResponseWriter, r *http.Request, body []byte)
212212

213213
type serverState struct {
214-
mu sync.Mutex
215-
requests []recordedRequest
216-
routes map[string]routeHandler // key: METHOD PATH (path without query)
217-
notFound routeHandler
214+
mu sync.Mutex
215+
requests []recordedRequest
216+
routes map[string]routeHandler // key: METHOD PATH (path without query)
217+
notFound routeHandler
218218
}
219219

220220
func newServerState() *serverState {

0 commit comments

Comments
 (0)