Skip to content

Commit 1a5dc47

Browse files
feat: use uint32 for page count (#193)
* feat: test build in circleci * fix: use uint32 for page count
1 parent 5cf7cef commit 1a5dc47

File tree

9 files changed

+154
-122
lines changed

9 files changed

+154
-122
lines changed

.circleci/config.yml

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,27 @@
33
# Check https://circleci.com/docs/2.0/language-go/ for more details
44
version: 2
55
jobs:
6-
test-go-1-13:
6+
test-go-tip: &base-test
77
docker:
8-
- image: circleci/golang:1.13
8+
- image: circleci/golang:latest
99
steps:
1010
- checkout
1111
- run: go mod download
1212
- run:
1313
name: Run unit tests
1414
command: go test -v ./...
15+
test-go-1-13:
16+
<<: *base-test
17+
docker:
18+
- image: circleci/golang:1.13
1519
test-go-1-12:
20+
<<: *base-test
1621
docker:
1722
- image: circleci/golang:1.12
18-
steps:
19-
- checkout
20-
- run: go mod download
21-
- run:
22-
name: Run unit tests
23-
command: go test -v ./...
2423
test-go-1-11:
24+
<<: *base-test
2525
docker:
2626
- image: circleci/golang:1.11
27-
steps:
28-
- checkout
29-
- run: go mod download
30-
- run:
31-
name: Run unit tests
32-
command: go test -v ./...
3327
test-go-1-10:
3428
docker:
3529
- image: circleci/golang:1.10
@@ -40,11 +34,47 @@ jobs:
4034
- run:
4135
name: Run unit tests
4236
command: go test -v ./...
37+
38+
test-build-1-13-amd64: &base-build
39+
docker:
40+
- image: circleci/golang:1.13
41+
environment:
42+
GOARCH: amd64
43+
steps:
44+
- checkout
45+
- run: go mod download
46+
- run:
47+
name: Test build
48+
command: go build ./...
49+
test-build-1-13-arm:
50+
<<: *base-build
51+
docker:
52+
- image: circleci/golang:1.13
53+
environment:
54+
GOARCH: arm
55+
test-build-1-13-arm64:
56+
<<: *base-build
57+
docker:
58+
- image: circleci/golang:1.13
59+
environment:
60+
GOARCH: arm64
61+
test-build-1-13-386:
62+
<<: *base-build
63+
docker:
64+
- image: circleci/golang:1.13
65+
environment:
66+
GOARCH: 386
67+
4368
workflows:
4469
version: 2
4570
test:
4671
jobs:
72+
- test-go-tip
4773
- test-go-1-13
4874
- test-go-1-12
4975
- test-go-1-11
5076
- test-go-1-10
77+
- test-build-1-13-amd64
78+
- test-build-1-13-arm
79+
- test-build-1-13-arm64
80+
- test-build-1-13-386

api/account/v2alpha1/account_sdk.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,21 @@ func (s *API) ListSSHKeys(req *ListSSHKeysRequest, opts ...scw.RequestOption) (*
176176

177177
// UnsafeGetTotalCount should not be used
178178
// Internal usage only
179-
func (r *ListSSHKeysResponse) UnsafeGetTotalCount() int {
180-
return int(r.TotalCount)
179+
func (r *ListSSHKeysResponse) UnsafeGetTotalCount() uint32 {
180+
return r.TotalCount
181181
}
182182

183183
// UnsafeAppend should not be used
184184
// Internal usage only
185-
func (r *ListSSHKeysResponse) UnsafeAppend(res interface{}) (int, scw.SdkError) {
185+
func (r *ListSSHKeysResponse) UnsafeAppend(res interface{}) (uint32, scw.SdkError) {
186186
results, ok := res.(*ListSSHKeysResponse)
187187
if !ok {
188188
return 0, errors.New("%T type cannot be appended to type %T", res, r)
189189
}
190190

191191
r.SSHKeys = append(r.SSHKeys, results.SSHKeys...)
192192
r.TotalCount += uint32(len(results.SSHKeys))
193-
return len(results.SSHKeys), nil
193+
return uint32(len(results.SSHKeys)), nil
194194
}
195195

196196
type CreateSSHKeyRequest struct {

api/baremetal/v1alpha1/baremetal_sdk.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,21 +491,21 @@ func (s *API) ListServers(req *ListServersRequest, opts ...scw.RequestOption) (*
491491

492492
// UnsafeGetTotalCount should not be used
493493
// Internal usage only
494-
func (r *ListServersResponse) UnsafeGetTotalCount() int {
495-
return int(r.TotalCount)
494+
func (r *ListServersResponse) UnsafeGetTotalCount() uint32 {
495+
return r.TotalCount
496496
}
497497

498498
// UnsafeAppend should not be used
499499
// Internal usage only
500-
func (r *ListServersResponse) UnsafeAppend(res interface{}) (int, scw.SdkError) {
500+
func (r *ListServersResponse) UnsafeAppend(res interface{}) (uint32, scw.SdkError) {
501501
results, ok := res.(*ListServersResponse)
502502
if !ok {
503503
return 0, errors.New("%T type cannot be appended to type %T", res, r)
504504
}
505505

506506
r.Servers = append(r.Servers, results.Servers...)
507507
r.TotalCount += uint32(len(results.Servers))
508-
return len(results.Servers), nil
508+
return uint32(len(results.Servers)), nil
509509
}
510510

511511
type GetServerRequest struct {
@@ -934,21 +934,21 @@ func (s *API) ListServerEvents(req *ListServerEventsRequest, opts ...scw.Request
934934

935935
// UnsafeGetTotalCount should not be used
936936
// Internal usage only
937-
func (r *ListServerEventsResponse) UnsafeGetTotalCount() int {
938-
return int(r.TotalCount)
937+
func (r *ListServerEventsResponse) UnsafeGetTotalCount() uint32 {
938+
return r.TotalCount
939939
}
940940

941941
// UnsafeAppend should not be used
942942
// Internal usage only
943-
func (r *ListServerEventsResponse) UnsafeAppend(res interface{}) (int, scw.SdkError) {
943+
func (r *ListServerEventsResponse) UnsafeAppend(res interface{}) (uint32, scw.SdkError) {
944944
results, ok := res.(*ListServerEventsResponse)
945945
if !ok {
946946
return 0, errors.New("%T type cannot be appended to type %T", res, r)
947947
}
948948

949949
r.Event = append(r.Event, results.Event...)
950950
r.TotalCount += uint32(len(results.Event))
951-
return len(results.Event), nil
951+
return uint32(len(results.Event)), nil
952952
}
953953

954954
type CreateRemoteServerAccessRequest struct {

0 commit comments

Comments
 (0)