Skip to content

Commit b8a79cc

Browse files
Merge main into proj/nb-udp
1 parent 23f7161 commit b8a79cc

File tree

426 files changed

+46482
-10850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+46482
-10850
lines changed

.github/workflows/ci.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ jobs:
1717
go-version: stable
1818

1919
- name: golangci-lint
20-
uses: golangci/golangci-lint-action@v6
20+
uses: golangci/golangci-lint-action@v8
2121
with:
2222
version: latest
2323

2424
- name: Run tidy
2525
run: make tidy
2626

27+
- name: Run formatter
28+
run: |
29+
go install mvdan.cc/gofumpt@86bffd62437a3c437c0b84d5d5ab244824e762fc
30+
gofumpt -l -w .
31+
2732
- name: Fail if changes
2833
run: git diff-index --exit-code HEAD
2934

@@ -50,7 +55,7 @@ jobs:
5055
python-version: '3.x'
5156

5257
- name: Install Python deps
53-
run: pip3 install requests wheel boto3
58+
run: pip3 install requests wheel boto3==1.35.99
5459

5560
- name: Install go-junit-report
5661
run: go install github.com/jstemmer/go-junit-report/v2@latest
@@ -85,7 +90,7 @@ jobs:
8590

8691
steps:
8792
- name: Notify Slack
88-
uses: slackapi/slack-github-action@v2.0.0
93+
uses: slackapi/slack-github-action@v2.1.0
8994
with:
9095
method: chat.postMessage
9196
token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/labeler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v4
2222
-
2323
name: Run Labeler
24-
uses: crazy-max/ghaction-github-labeler@b54af0c25861143e7c8813d7cbbf46d2c341680c
24+
uses: crazy-max/ghaction-github-labeler@24d110aa46a59976b8a7f35518cb7f14f434c916
2525
with:
2626
github-token: ${{ secrets.GITHUB_TOKEN }}
2727
yaml-file: .github/labels.yml

.github/workflows/nightly_smoke_tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
- name: Run smoke tests
3333
id: smoke_tests
3434
run: |
35-
make smoketest
35+
make test-smoke
3636
env:
3737
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
3838

3939
- name: Notify Slack
4040
if: (success() || failure()) && github.repository == 'linode/linodego'
41-
uses: slackapi/slack-github-action@v2.0.0
41+
uses: slackapi/slack-github-action@v2.1.0
4242
with:
4343
method: chat.postMessage
4444
token: ${{ secrets.SLACK_BOT_TOKEN }}

.github/workflows/release-cross-repo-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ jobs:
3636
3737
- name: run tests
3838
run: |
39-
make int-test
39+
make test-int
4040
env:
4141
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}

.github/workflows/release-notify-slack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Notify Slack - Main Message
13-
uses: slackapi/slack-github-action@v2.0.0
13+
uses: slackapi/slack-github-action@v2.1.0
1414
with:
1515
method: chat.postMessage
1616
token: ${{ secrets.SLACK_BOT_TOKEN }}

.golangci.yml

+71-61
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,85 @@
1+
version: "2"
12
run:
23
tests: false
3-
4-
linters-settings:
5-
errcheck:
6-
check-type-assertions: true
7-
check-blank: true
8-
9-
govet:
10-
enable:
11-
- atomicalign
12-
- shadow
13-
enable-all: false
14-
disable-all: false
15-
gocyclo:
16-
min-complexity: 30
17-
gocognit:
18-
min-complexity: 30
19-
dupl:
20-
threshold: 100
21-
224
linters:
23-
enable-all: true
5+
default: all
246
disable:
25-
# deprecated linters
26-
- exportloopref
27-
####################
28-
29-
# conflicted with go fmt
30-
- nolintlint
31-
32-
# workaround to avoid linter failures of getting malformed json
33-
- musttag
34-
35-
- err113
36-
377
- bodyclose
388
- contextcheck
39-
- nilerr
40-
- noctx
41-
- rowserrcheck
42-
- sqlclosecheck
43-
- tparallel
9+
- cyclop
10+
- depguard
11+
- dupl
12+
- durationcheck
13+
- err113
14+
- errcheck
4415
- errname
16+
- errorlint
17+
- exhaustive
18+
- exhaustruct
4519
- forcetypeassert
20+
- gochecknoglobals
21+
- gochecknoinits
4622
- gocyclo
47-
- unparam
48-
- nakedret
49-
- lll
50-
- dupl
23+
- godot
5124
- gosec
52-
- gochecknoinits
53-
- gochecknoglobals
54-
- exhaustruct
25+
- inamedparam
26+
- lll
27+
- musttag
28+
- nakedret
29+
- nilerr
30+
- nlreturn
31+
- noctx
32+
- nolintlint
5533
- nonamedreturns
56-
- errcheck
34+
- perfsprint
35+
- recvcheck
36+
- rowserrcheck
37+
- sqlclosecheck
5738
- staticcheck
58-
- stylecheck
59-
- wsl
60-
- varnamelen
39+
- tagalign
6140
- tagliatelle
62-
- nlreturn
63-
- wrapcheck
41+
- tparallel
42+
- unparam
43+
- varnamelen
6444
- wastedassign
65-
- durationcheck
66-
- errorlint
67-
- cyclop
68-
- godot
69-
- exhaustive
70-
- depguard
71-
- tagalign
72-
- inamedparam
73-
- perfsprint
74-
- recvcheck
75-
fast: false
45+
- wrapcheck
46+
- wsl
47+
settings:
48+
dupl:
49+
threshold: 100
50+
errcheck:
51+
check-type-assertions: true
52+
check-blank: true
53+
gocognit:
54+
min-complexity: 30
55+
gocyclo:
56+
min-complexity: 30
57+
govet:
58+
enable:
59+
- atomicalign
60+
- shadow
61+
enable-all: false
62+
disable-all: false
63+
exclusions:
64+
generated: lax
65+
presets:
66+
- comments
67+
- common-false-positives
68+
- legacy
69+
- std-error-handling
70+
paths:
71+
- third_party$
72+
- builtin$
73+
- examples$
74+
formatters:
75+
enable:
76+
- gci
77+
- gofmt
78+
- gofumpt
79+
- goimports
80+
exclusions:
81+
generated: lax
82+
paths:
83+
- third_party$
84+
- builtin$
85+
- examples$

Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ PACKAGES := $(shell go list ./... | grep -v integration)
1717

1818
SKIP_LINT ?= 0
1919

20-
.PHONY: build vet test refresh-fixtures clean clean-cov clean-fixtures lint run_fixtures sanitize fixtures godoc testint testunit testcov tidy
20+
.PHONY: build vet test refresh-fixtures clean clean-cov clean-fixtures lint run_fixtures sanitize fixtures godoc test-int test-unit test-smoke testcov tidy
2121

22-
test: build lint testunit testint
22+
test: build lint test-unit test-int
2323

2424
citest: lint test
2525

26-
testunit:
27-
go test -v $(PACKAGES) $(ARGS)
28-
cd test && make testunit
26+
test-unit:
27+
go test -v $(PACKAGES) $(TEST_ARGS)
28+
cd test && make test-unit
2929

30-
testint:
31-
cd test && make testint
30+
test-int:
31+
cd test && make test-int
3232

3333
testcov-func:
3434
@go test -v -coverprofile="coverage.txt" . > /dev/null 2>&1
@@ -39,8 +39,8 @@ testcov-html:
3939
@go test -v -coverprofile="coverage.txt" . > /dev/null 2>&1
4040
@go tool cover -html coverage.txt
4141

42-
smoketest:
43-
cd test && make smoketest
42+
test-smoke:
43+
cd test && make test-smoke
4444

4545
build: vet lint
4646
go build ./...
@@ -77,7 +77,7 @@ run_fixtures:
7777
LINODE_API_VERSION="v4beta" \
7878
LINODE_URL="$(LINODE_URL)" \
7979
GO111MODULE="on" \
80-
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(ARGS)
80+
go test --tags $(TEST_TAGS) -timeout=$(TEST_TIMEOUT) -v $(TEST_ARGS)
8181

8282
sanitize:
8383
@echo "* Sanitizing fixtures"

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ When performing a `POST` or `PUT` request, multiple field related errors will be
168168

169169
## Tests
170170

171-
Run `make testunit` to run the unit tests.
171+
Run `make test-unit` to run the unit tests.
172172

173-
Run `make testint` to run the integration tests. The integration tests use fixtures.
173+
Run `make test-int` to run the integration tests. The integration tests use fixtures.
174174

175175
To update the test fixtures, run `make fixtures`. This will record the API responses into the `fixtures/` directory.
176176
Be careful about committing any sensitive account details. An attempt has been made to sanitize IP addresses and
177177
dates, but no automated sanitization will be performed against `fixtures/*Account*.yaml`, for example.
178178

179-
To prevent disrupting unaffected fixtures, target fixture generation like so: `make ARGS="-run TestListVolumes" fixtures`.
179+
To prevent disrupting unaffected fixtures, target fixture generation like so: `make TEST_ARGS="-run TestListVolumes" fixtures`.
180180

181181
## Discussion / Help
182182

account_agreements.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ func (c *Client) GetAccountAgreements(ctx context.Context) (*AccountAgreements,
3232

3333
// AcknowledgeAccountAgreements acknowledges account agreements for the Account
3434
func (c *Client) AcknowledgeAccountAgreements(ctx context.Context, opts AccountAgreementsUpdateOptions) error {
35-
_, err := doPOSTRequest[AccountAgreements](ctx, c, "account/agreements", opts)
36-
return err
35+
return doPOSTRequestNoResponseBody(ctx, c, "account/agreements", opts)
3736
}

account_availability.go

+2-12
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,11 @@ type AccountAvailability struct {
1818

1919
// ListAccountAvailabilities lists all regions and the resource availabilities to the account.
2020
func (c *Client) ListAccountAvailabilities(ctx context.Context, opts *ListOptions) ([]AccountAvailability, error) {
21-
response, err := getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts)
22-
if err != nil {
23-
return nil, err
24-
}
25-
26-
return response, nil
21+
return getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts)
2722
}
2823

2924
// GetAccountAvailability gets the resources availability in a region to the customer.
3025
func (c *Client) GetAccountAvailability(ctx context.Context, regionID string) (*AccountAvailability, error) {
3126
b := formatAPIPath("account/availability/%s", regionID)
32-
response, err := doGETRequest[AccountAvailability](ctx, c, b)
33-
if err != nil {
34-
return nil, err
35-
}
36-
37-
return response, nil
27+
return doGETRequest[AccountAvailability](ctx, c, b)
3828
}

account_betas.go

+4-21
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,16 @@ func (cBeta *AccountBetaProgram) UnmarshalJSON(b []byte) error {
5151

5252
// ListAccountBetaPrograms lists all beta programs an account is enrolled in.
5353
func (c *Client) ListAccountBetaPrograms(ctx context.Context, opts *ListOptions) ([]AccountBetaProgram, error) {
54-
response, err := getPaginatedResults[AccountBetaProgram](ctx, c, "/account/betas", opts)
55-
if err != nil {
56-
return nil, err
57-
}
58-
59-
return response, nil
54+
return getPaginatedResults[AccountBetaProgram](ctx, c, "/account/betas", opts)
6055
}
6156

6257
// GetAccountBetaProgram gets the details of a beta program an account is enrolled in.
6358
func (c *Client) GetAccountBetaProgram(ctx context.Context, betaID string) (*AccountBetaProgram, error) {
64-
b := formatAPIPath("/account/betas/%s", betaID)
65-
66-
response, err := doGETRequest[AccountBetaProgram](ctx, c, b)
67-
if err != nil {
68-
return nil, err
69-
}
70-
71-
return response, nil
59+
e := formatAPIPath("/account/betas/%s", betaID)
60+
return doGETRequest[AccountBetaProgram](ctx, c, e)
7261
}
7362

7463
// JoinBetaProgram enrolls an account into a beta program.
7564
func (c *Client) JoinBetaProgram(ctx context.Context, opts AccountBetaProgramCreateOpts) (*AccountBetaProgram, error) {
76-
e := "account/betas"
77-
response, err := doPOSTRequest[AccountBetaProgram](ctx, c, e, opts)
78-
if err != nil {
79-
return nil, err
80-
}
81-
82-
return response, nil
65+
return doPOSTRequest[AccountBetaProgram](ctx, c, "account/betas", opts)
8366
}

0 commit comments

Comments
 (0)