Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 1553b1d

Browse files
committed
fix: update convert.go for rootly-go 0.8.0 breaking changes
- Rename ServiceIds -> ServiceIDs, EnvironmentIds -> EnvironmentIDs - Update Labels and Refs to use []nullable.Nullable[struct{...}] - Fix Dockerfile to use go mod download instead of deprecated go get
1 parent 23b4357 commit 1553b1d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LABEL description="Command-line tool for rootly"
88
COPY . /usr/src/app
99
WORKDIR /usr/src/app
1010
# Installing dependencies and build the binary
11-
RUN go get -v -t -d all && \
11+
RUN go mod download && \
1212
make build
1313

1414
# hadolint ignore=DL3006,DL3007

pkg/api/convert.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ import (
1010
"github.com/rootlyhq/rootly-go"
1111
)
1212

13-
// Convert a map to a APIObject
14-
func convertObject(maps []map[string]string) []struct {
15-
Key string "json:\"key\""
16-
Value string "json:\"value\""
17-
} {
18-
objects := []struct {
13+
// Convert a map to nullable API objects
14+
func convertObject(maps []map[string]string) []nullable.Nullable[struct {
15+
Key string `json:"key"`
16+
Value string `json:"value"`
17+
}] {
18+
var objects []nullable.Nullable[struct {
1919
Key string `json:"key"`
2020
Value string `json:"value"`
21-
}{}
21+
}]
2222
for _, mapData := range maps {
23-
objects = append(objects, struct {
23+
objects = append(objects, nullable.NewNullableWithValue(struct {
2424
Key string `json:"key"`
2525
Value string `json:"value"`
2626
}{
2727
Key: mapData["key"],
2828
Value: mapData["value"],
29-
})
29+
}))
3030
}
3131
return objects
3232
}
@@ -47,18 +47,18 @@ func convertPulse(pulse models.Pulse) (string, log.CtxErr) {
4747
data.Data.Attributes.StartedAt = nullable.NewNullableWithValue[time.Time](pulse.StartedAt)
4848
}
4949
if len(pulse.ServiceIds) != 0 {
50-
data.Data.Attributes.ServiceIds = nullable.NewNullableWithValue(pulse.ServiceIds)
50+
data.Data.Attributes.ServiceIDs = nullable.NewNullableWithValue(pulse.ServiceIds)
5151
}
5252
if len(pulse.EnvironmentIds) != 0 {
53-
data.Data.Attributes.EnvironmentIds = nullable.NewNullableWithValue(pulse.EnvironmentIds)
53+
data.Data.Attributes.EnvironmentIDs = nullable.NewNullableWithValue(pulse.EnvironmentIds)
5454
}
5555
labels := convertObject(pulse.Labels)
5656
if len(labels) != 0 {
57-
data.Data.Attributes.Labels = &labels
57+
data.Data.Attributes.Labels = labels
5858
}
5959
refs := convertObject(pulse.Refs)
6060
if len(refs) != 0 {
61-
data.Data.Attributes.Refs = &refs
61+
data.Data.Attributes.Refs = refs
6262
}
6363

6464
// Marshaling the data

0 commit comments

Comments
 (0)