Skip to content

Commit 6579c50

Browse files
committed
more renaming
1 parent f72b6b8 commit 6579c50

18 files changed

Lines changed: 181 additions & 181 deletions

e2e/calendars_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ func TestListCalendars_WithRemote(t *testing.T) {
100100
_ = c.RemoveCalendar(testCalendarName)
101101
})
102102

103-
remoteUrl := "https://github.com/git-calendar/calendar.git"
103+
remoteURL := "https://github.com/git-calendar/calendar.git"
104104

105-
err = c.UpdateRemote(testCalendarName, mustParseUrl(remoteUrl), false)
105+
err = c.UpdateRemote(testCalendarName, mustParseURL(remoteURL), false)
106106
if err != nil {
107107
t.Fatalf("failed to update remotes: %v", err)
108108
}
@@ -121,8 +121,8 @@ func TestListCalendars_WithRemote(t *testing.T) {
121121
if err != nil {
122122
t.Fatalf("failed to get remote url: %v", err)
123123
}
124-
if rurl != remoteUrl {
125-
t.Fatalf("remote url mismatch: got %v, want %v", rurl, remoteUrl)
124+
if rurl != remoteURL {
125+
t.Fatalf("remote url mismatch: got %v, want %v", rurl, remoteURL)
126126
}
127127
found = true
128128
break
@@ -140,7 +140,7 @@ func TestRemoveCalendar(t *testing.T) {
140140
if err != nil {
141141
t.Fatalf("failed to create calendar: %v", err)
142142
}
143-
if err := c.UpdateRemote(testCalendarName, mustParseUrl("https://example.com/calendar.git"), true); err != nil {
143+
if err := c.UpdateRemote(testCalendarName, mustParseURL("https://example.com/calendar.git"), true); err != nil {
144144
t.Fatalf("failed to make calendar read-only: %v", err)
145145
}
146146

@@ -327,7 +327,7 @@ func TestRenameCalendar_AlreadyExists(t *testing.T) {
327327
}
328328

329329
// Helper
330-
func mustParseUrl(raw string) *url.URL {
330+
func mustParseURL(raw string) *url.URL {
331331
u, err := url.Parse(raw)
332332
if err != nil {
333333
panic(fmt.Sprintf("failed to parse url: %v", err))

e2e/events_basic_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ func TestGetEvents_FilterByCalendarAndTag(t *testing.T) {
396396
}
397397

398398
got := c.GetEvents(from.Add(-time.Hour), to.Add(time.Hour), core.GetEventsFilter{
399-
calendarA: {HiddenTagIds: []uuid.UUID{tagB}},
400-
calendarB: {HiddenTagIds: []uuid.UUID{tagA}},
399+
calendarA: {HiddenTagIDs: []uuid.UUID{tagB}},
400+
calendarB: {HiddenTagIDs: []uuid.UUID{tagA}},
401401
})
402402

403403
if len(got) != 1 {

e2e/events_repeating_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ func TestRepeatingEvent_Update_StrategiesRejectParentEvents(t *testing.T) {
258258
func TestRepeatingEvent_Update_Following_SplitsSeriesFromTargetChild(t *testing.T) {
259259
c := newTestCore(t)
260260

261-
parentId := uuid.New()
261+
parentID := uuid.New()
262262
startTime := time.Date(2026, 1, 1, 10, 0, 0, 0, time.UTC)
263263
parent := core.Event{
264-
ID: parentId,
264+
ID: parentID,
265265
Calendar: testCalendarName,
266266
Title: "Daily Meeting",
267267
From: startTime,
@@ -284,7 +284,7 @@ func TestRepeatingEvent_Update_Following_SplitsSeriesFromTargetChild(t *testing.
284284
}
285285

286286
if newParent.ParentID != nil {
287-
t.Fatalf("new event should be a parent, got ParentId %s", newParent.ParentID)
287+
t.Fatalf("new event should be a parent, got ParentID %s", newParent.ParentID)
288288
}
289289
if newParent.Title != updated.Title {
290290
t.Fatalf("new parent title mismatch: expected %q, got %q", updated.Title, newParent.Title)
@@ -293,7 +293,7 @@ func TestRepeatingEvent_Update_Following_SplitsSeriesFromTargetChild(t *testing.
293293
t.Fatalf("new parent From mismatch: expected %s, got %s", target.From, newParent.From)
294294
}
295295

296-
oldParent := requireEvent(t, c, parentId)
296+
oldParent := requireEvent(t, c, parentID)
297297
if oldParent.Repeat == nil {
298298
t.Fatalf("old parent should still repeat before the split")
299299
}
@@ -307,10 +307,10 @@ func TestRepeatingEvent_Update_Following_SplitsSeriesFromTargetChild(t *testing.
307307
func TestRepeatingEvent_Update_Following_SecondChild_DoesNotLeaveInvalidOldParent(t *testing.T) {
308308
c := newTestCore(t)
309309

310-
parentId := uuid.New()
310+
parentID := uuid.New()
311311
startTime := time.Date(2026, 1, 1, 10, 0, 0, 0, time.UTC)
312312
parent := core.Event{
313-
ID: parentId,
313+
ID: parentID,
314314
Calendar: testCalendarName,
315315
Title: "Daily Meeting",
316316
From: startTime,
@@ -331,10 +331,10 @@ func TestRepeatingEvent_Update_Following_SecondChild_DoesNotLeaveInvalidOldParen
331331
t.Fatalf("failed to update second child with Following strategy: %v", err)
332332
}
333333
if newParent.ParentID != nil {
334-
t.Fatalf("new event should be a parent, got ParentId %s", newParent.ParentID)
334+
t.Fatalf("new event should be a parent, got ParentID %s", newParent.ParentID)
335335
}
336336

337-
oldParent := requireEvent(t, c, parentId)
337+
oldParent := requireEvent(t, c, parentID)
338338
if oldParent.Repeat != nil {
339339
t.Fatalf("old parent should not repeat when only its first occurrence remains; got RRULE %q", oldParent.Repeat.GetRRule().OrigOptions.RRuleString())
340340
}

e2e/git_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ func TestUpdateRemote_ReplacesExistingRemote(t *testing.T) {
2121
oldCalRemote := "https://github.com/git-calendar/old-calendar.git"
2222
newCalRemote := "https://github.com/git-calendar/new-calendar.git"
2323

24-
err = c.UpdateRemote(testCalendarName, mustParseUrl(oldCalRemote), false)
24+
err = c.UpdateRemote(testCalendarName, mustParseURL(oldCalRemote), false)
2525
if err != nil {
2626
t.Fatalf("failed to set initial remotes: %v", err)
2727
}
2828

29-
err = c.UpdateRemote(testCalendarName, mustParseUrl(newCalRemote), true)
29+
err = c.UpdateRemote(testCalendarName, mustParseURL(newCalRemote), true)
3030
if err != nil {
3131
t.Fatalf("failed to replace remotes: %v", err)
3232
}
@@ -44,12 +44,12 @@ func TestUpdateRemote_ReplacesExistingRemote(t *testing.T) {
4444
if calendar.Name != testCalendarName {
4545
continue
4646
}
47-
remoteUrl, err := calendar.RemoteURL()
47+
remoteURL, err := calendar.RemoteURL()
4848
if err != nil {
4949
t.Fatalf("failed to get remote url: %v", err)
5050
}
51-
if remoteUrl != newCalRemote {
52-
t.Fatalf("remote url mismatch: got %v, want %v", remoteUrl, newCalRemote)
51+
if remoteURL != newCalRemote {
52+
t.Fatalf("remote url mismatch: got %v, want %v", remoteURL, newCalRemote)
5353
}
5454
if !calendar.Readonly {
5555
t.Fatal("calendar is not read-only after updating the remote")
@@ -75,7 +75,7 @@ func TestUpdateRemote_DeletesWhenEmpty(t *testing.T) {
7575
_ = c.RemoveCalendar(testCalendarName)
7676
})
7777

78-
err = c.UpdateRemote(testCalendarName, mustParseUrl("https://github.com/git-calendar/calendar.git"), true)
78+
err = c.UpdateRemote(testCalendarName, mustParseURL("https://github.com/git-calendar/calendar.git"), true)
7979
if err != nil {
8080
t.Fatalf("failed to set remotes: %v", err)
8181
}
@@ -98,12 +98,12 @@ func TestUpdateRemote_DeletesWhenEmpty(t *testing.T) {
9898
if calendar.Name != testCalendarName {
9999
continue
100100
}
101-
remoteUrl, err := calendar.RemoteURL()
101+
remoteURL, err := calendar.RemoteURL()
102102
if err != nil {
103103
t.Fatalf("failed to get remote url: %v", err)
104104
}
105-
if remoteUrl != "" {
106-
t.Fatalf("remote url mismatch: got %v, want \"\"", remoteUrl)
105+
if remoteURL != "" {
106+
t.Fatalf("remote url mismatch: got %v, want \"\"", remoteURL)
107107
}
108108
if calendar.Readonly {
109109
t.Fatal("calendar is still read-only after clearing the remote")
@@ -125,7 +125,7 @@ func TestUpdateRemote_MissingCalendar(t *testing.T) {
125125
t.Fatal(err)
126126
}
127127

128-
err = c.UpdateRemote(testCalendarName, mustParseUrl("https://github.com/git-calendar/calendar.git"), false)
128+
err = c.UpdateRemote(testCalendarName, mustParseURL("https://github.com/git-calendar/calendar.git"), false)
129129
if err == nil {
130130
t.Fatal("expected error, got nil")
131131
}

e2e/tags_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestTag_CreateTag_InvalidTagReturnsError(t *testing.T) {
4545
c := newTestCore(t)
4646

4747
tag := core.Tag{
48-
Id: uuid.New(),
48+
ID: uuid.New(),
4949
Color: "blue",
5050
}
5151

@@ -60,7 +60,7 @@ func TestTag_CreateTag_InvalidTagReturnsError(t *testing.T) {
6060

6161
func TestTag_CreateTag_ReadonlyCalendarReturnsError(t *testing.T) {
6262
c := newTestCore(t)
63-
if err := c.UpdateRemote(testCalendarName, mustParseUrl("https://example.com/calendar.git"), true); err != nil {
63+
if err := c.UpdateRemote(testCalendarName, mustParseURL("https://example.com/calendar.git"), true); err != nil {
6464
t.Fatalf("failed to make calendar read-only: %v", err)
6565
}
6666

@@ -83,7 +83,7 @@ func TestTag_UpdateTag_UpdatesExistingTag(t *testing.T) {
8383
}
8484

8585
updated := core.Tag{
86-
Id: tag.Id,
86+
ID: tag.ID,
8787
Name: "personal",
8888
Color: "blue",
8989
}
@@ -139,13 +139,13 @@ func TestTag_RemoveTag_RemovesTag(t *testing.T) {
139139
t.Fatalf("CreateTag failed: %v", err)
140140
}
141141

142-
if err := c.RemoveTag(testCalendarName, tag.Id); err != nil {
142+
if err := c.RemoveTag(testCalendarName, tag.ID); err != nil {
143143
t.Fatalf("RemoveTag failed: %v", err)
144144
}
145145

146146
// creating the same id again proves it was removed from the in-memory tag list
147147
recreated := core.Tag{
148-
Id: tag.Id,
148+
ID: tag.ID,
149149
Name: "recreated",
150150
Color: "blue",
151151
}
@@ -161,7 +161,7 @@ func TestTag_RemoveTag_RemovesTag(t *testing.T) {
161161
assertTagEqual(t, recreated, *got)
162162
}
163163

164-
func TestTag_RemoveTag_InvalidIdReturnsError(t *testing.T) {
164+
func TestTag_RemoveTag_InvalidIDReturnsError(t *testing.T) {
165165
c := newTestCore(t)
166166

167167
err := c.RemoveTag(testCalendarName, uuid.Nil)
@@ -183,14 +183,14 @@ func TestTag_InvalidCalendarReturnsError(t *testing.T) {
183183
t.Fatalf("expected UpdateTag invalid calendar error")
184184
}
185185

186-
if err := c.RemoveTag("missing", tag.Id); err == nil {
186+
if err := c.RemoveTag("missing", tag.ID); err == nil {
187187
t.Fatalf("expected RemoveTag invalid calendar error")
188188
}
189189
}
190190

191191
func newTestTag(name string, color string) core.Tag {
192192
return core.Tag{
193-
Id: uuid.New(),
193+
ID: uuid.New(),
194194
Name: name,
195195
Color: color,
196196
}
@@ -199,8 +199,8 @@ func newTestTag(name string, color string) core.Tag {
199199
func assertTagEqual(t *testing.T, want core.Tag, got core.Tag) {
200200
t.Helper()
201201

202-
if got.Id != want.Id {
203-
t.Fatalf("tag id mismatch: expected %s, got %s", want.Id, got.Id)
202+
if got.ID != want.ID {
203+
t.Fatalf("tag id mismatch: expected %s, got %s", want.ID, got.ID)
204204
}
205205
if got.Name != want.Name {
206206
t.Fatalf("tag name mismatch: expected %q, got %q", want.Name, got.Name)

pkg/api/models.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package api
33
// Event defines the event shape generated by gomobile for Kotlin and Swift.
44
// Core does not use this type internally.
55
type Event struct {
6-
// Id is the event identifier.
7-
Id string
6+
// ID is the event identifier.
7+
ID string
88
// Title is the event title.
99
Title string
1010
// Location is the event location.
@@ -19,10 +19,10 @@ type Event struct {
1919
To string
2020
// Calendar is the name of the containing calendar.
2121
Calendar string
22-
// TagId is the associated tag identifier.
23-
TagId string
24-
// ParentId is the identifier of the parent repeating event.
25-
ParentId string
22+
// TagID is the associated tag identifier.
23+
TagID string
24+
// ParentID is the identifier of the parent repeating event.
25+
ParentID string
2626
// Repeat is a DTSTART, RRULE, and EXDATE definition in RFC 5545 format.
2727
Repeat string
2828
}
@@ -34,8 +34,8 @@ type Calendar struct {
3434
Name string
3535
// Tags contains the calendar's tags.
3636
Tags []Tag
37-
// RemoteUrl is the configured remote URL.
38-
RemoteUrl string
37+
// RemoteURL is the configured remote URL.
38+
RemoteURL string
3939
// Encrypted reports whether the calendar is encrypted.
4040
Encrypted bool
4141
// Readonly reports whether the calendar is read-only.
@@ -45,8 +45,8 @@ type Calendar struct {
4545
// Tag defines the tag shape generated by gomobile for Kotlin and Swift.
4646
// Core does not use this type internally.
4747
type Tag struct {
48-
// Id is the tag identifier.
49-
Id string
48+
// ID is the tag identifier.
49+
ID string
5050
// Name is the tag name.
5151
Name string
5252
// Color is the tag color.

pkg/core/calendar.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (cal *Calendar) MarshalJSON() ([]byte, error) {
7373
Name string `json:"name"`
7474
Tags []Tag `json:"tags"`
7575
RemoteURL string `json:"remote_url"`
76-
ICalUrl string `json:"ical_url"`
76+
ICalURL string `json:"ical_url"`
7777
Encrypted bool `json:"encrypted"`
7878
Readonly bool `json:"readonly"`
7979
}
@@ -92,7 +92,7 @@ func (cal *Calendar) MarshalJSON() ([]byte, error) {
9292
Name: cal.Name,
9393
Tags: cal.Tags,
9494
RemoteURL: remoteURL,
95-
ICalUrl: icalURL,
95+
ICalURL: icalURL,
9696
Encrypted: cal.IsEncrypted(),
9797
Readonly: cal.Readonly,
9898
})

pkg/core/core.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Core struct {
2929
events map[uuid.UUID]*Event
3030
calendars map[string]*Calendar
3131
fs billy.Filesystem // root "/" for OPFS/IDB, "$HOME" for classic FS
32-
proxyUrl *url.URL // cors proxy, that works like https://cors-proxy.abc/https://github.com/... (only needed for the browser!)
32+
proxyURL *url.URL // cors proxy, that works like https://cors-proxy.abc/https://github.com/... (only needed for the browser!)
3333
}
3434

3535
// NewCore creates an initialized Core using the platform filesystem.
@@ -48,15 +48,15 @@ func NewCore() *Core {
4848
}
4949

5050
// SetCorsProxy configures the CORS proxy used by browser transports.
51-
func (c *Core) SetCorsProxy(proxyUrl string) error {
52-
if proxyUrl == "" {
53-
c.proxyUrl = nil
51+
func (c *Core) SetCorsProxy(proxyURL string) error {
52+
if proxyURL == "" {
53+
c.proxyURL = nil
5454
return nil
5555
}
5656

5757
var err error
58-
trimmed := strings.TrimSuffix(proxyUrl, "/") // remove trailing "/"
59-
c.proxyUrl, err = url.ParseRequestURI(trimmed)
58+
trimmed := strings.TrimSuffix(proxyURL, "/") // remove trailing "/"
59+
c.proxyURL, err = url.ParseRequestURI(trimmed)
6060
return err
6161
}
6262

@@ -100,7 +100,7 @@ func (c *Core) SyncAll() error {
100100

101101
// syncCalendar assumes the worktree is clean and all local calendar changes have already been committed.
102102
func (c *Core) syncCalendar(cal *Calendar) error {
103-
if err := fetchCalendar(cal, c.proxyUrl); err != nil {
103+
if err := fetchCalendar(cal, c.proxyURL); err != nil {
104104
switch {
105105
case errors.Is(err, gogit.ErrRemoteNotFound):
106106
return nil // this is ok
@@ -115,7 +115,7 @@ func (c *Core) syncCalendar(cal *Calendar) error {
115115
if localCommit == nil {
116116
return nil // local and remote are both empty
117117
}
118-
return pushCalendar(cal, c.proxyUrl)
118+
return pushCalendar(cal, c.proxyURL)
119119

120120
default:
121121
return fmt.Errorf("fetch: %w", err)
@@ -137,7 +137,7 @@ func (c *Core) syncCalendar(cal *Calendar) error {
137137

138138
case remoteCommit == nil:
139139
// remote has no commits
140-
return pushCalendar(cal, c.proxyUrl)
140+
return pushCalendar(cal, c.proxyURL)
141141

142142
case localCommit.Hash == remoteCommit.Hash:
143143
return nil // already in sync
@@ -148,7 +148,7 @@ func (c *Core) syncCalendar(cal *Calendar) error {
148148

149149
case isAncestor(remoteCommit, localCommit):
150150
// local is ahead
151-
return pushCalendar(cal, c.proxyUrl)
151+
return pushCalendar(cal, c.proxyURL)
152152

153153
default:
154154
// Diverged histories require the custom merge policy before pushing.
@@ -159,7 +159,7 @@ func (c *Core) syncCalendar(cal *Calendar) error {
159159
}
160160
fmt.Printf("Custom merge successful for %q\n", cal.Name)
161161

162-
return pushCalendar(cal, c.proxyUrl)
162+
return pushCalendar(cal, c.proxyURL)
163163
}
164164
}
165165

0 commit comments

Comments
 (0)