Skip to content

Commit 7307355

Browse files
authored
Modernize (#277)
* fix: format code with gofumpt Signed-off-by: Federico Guerinoni <[email protected]> * ci: bump GH actions Signed-off-by: Federico Guerinoni <[email protected]> * chore: drop support go 1.17 * chore: update golangci-linter Signed-off-by: Federico Guerinoni <[email protected]> --------- Signed-off-by: Federico Guerinoni <[email protected]>
1 parent de3fb69 commit 7307355

25 files changed

+78
-98
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
max-parallel: 3
1818
fail-fast: false
1919
matrix:
20-
goVer: ['1.17', '1.18', '1.19', '1.20', '1.21', '1.22']
20+
goVer: ['1.18', '1.19', '1.20', '1.21', '1.22']
2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323

2424
- name: Set up Go ${{ matrix.goVer }}
25-
uses: actions/setup-go@v3
25+
uses: actions/setup-go@v5
2626
with:
2727
go-version: ${{ matrix.goVer }}
2828

.github/workflows/initiate_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: 🚀 Create release PR
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0 # gives the changelog generator access to all previous commits
1818

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Commit message linter
2020
uses: wagoid/commitlint-github-action@v4
2121

2222
- name: Setup Go
23-
uses: actions/setup-go@v3
23+
uses: actions/setup-go@v5
2424
with:
2525
go-version: "1.18"
2626

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
15+
- uses: actions/checkout@v4
1816

1917
- uses: actions/github-script@v6
2018
with:

.github/workflows/reviewdog.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ jobs:
1111
name: 🐶 Reviewdog
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

1616
- uses: reviewdog/action-setup@v1
1717
with:
1818
reviewdog_version: latest
1919

2020
- name: Setup Go
21-
uses: actions/setup-go@v3
21+
uses: actions/setup-go@v5
2222
with:
23-
go-version: '1.17'
23+
go-version: '1.18'
2424

2525
- name: Install golangci-lint
2626
run: make install-golangci

.golangci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,19 @@ run:
3838
linters:
3939
enable-all: true
4040
disable:
41-
- contextcheck
42-
- exhaustivestruct
41+
- depguard
42+
- tagalign
43+
- err113
4344
- exhaustruct
44-
- funlen
4545
- gochecknoglobals
4646
- godox
47-
- goerr113
48-
- golint
4947
- gomnd
50-
- interfacer
5148
- lll
52-
- maligned
49+
- mnd
5350
- nlreturn
5451
- nonamedreturns
5552
- paralleltest
56-
- scopelint
5753
- tagliatelle
58-
- thelper
5954
- varnamelen
6055
- wrapcheck
6156
- wsl
@@ -74,3 +69,8 @@ issues:
7469
linters:
7570
- gosec
7671
- testpackage # makes you use a separate _test package
72+
- gochecknoinits
73+
- depguard
74+
- testableexamples
75+
- contextcheck
76+
- funlen

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GOLANGCI_VERSION = 1.46.2
1+
GOLANGCI_VERSION = 1.58.2
22
GOLANGCI = vendor/golangci-lint/$(GOLANGCI_VERSION)/golangci-lint
33

44
install-golangci:

app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func NewAppSettings() *AppSettings {
100100

101101
type AsyncModerationCallback struct {
102102
Mode string `json:"mode"`
103-
ServerUrl string `json:"server_url"`
103+
ServerURL string `json:"server_url"`
104104
}
105105

106106
type AsyncModerationConfiguration struct {

app_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestClient_CheckAsyncModeConfig(t *testing.T) {
3636
AsyncModerationConfiguration{
3737
Callback: &AsyncModerationCallback{
3838
Mode: "CALLBACK_MODE_REST",
39-
ServerUrl: "https://example.com/gosdk",
39+
ServerURL: "https://example.com/gosdk",
4040
},
4141
Timeout: 10000,
4242
},

async_tasks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type TaskResponse struct {
3333
// GetTask returns the status of a task that has been ran asynchronously.
3434
func (c *Client) GetTask(ctx context.Context, id string) (*TaskResponse, error) {
3535
if id == "" {
36-
return nil, fmt.Errorf("id should not be empty")
36+
return nil, errors.New("id should not be empty")
3737
}
3838

3939
p := path.Join("tasks", url.PathEscape(id))
@@ -53,7 +53,7 @@ type AsyncTaskResponse struct {
5353
// It returns an AsyncTaskResponse object which contains the task ID, the status of the task can be check with client.GetTask method.
5454
func (c *Client) DeleteChannels(ctx context.Context, cids []string, hardDelete bool) (*AsyncTaskResponse, error) {
5555
if len(cids) == 0 {
56-
return nil, fmt.Errorf("cids parameter should not be empty")
56+
return nil, errors.New("cids parameter should not be empty")
5757
}
5858

5959
data := struct {
@@ -91,7 +91,7 @@ type DeleteUserOptions struct {
9191
// It returns an AsyncTaskResponse object which contains the task ID, the status of the task can be check with client.GetTask method.
9292
func (c *Client) DeleteUsers(ctx context.Context, userIDs []string, options DeleteUserOptions) (*AsyncTaskResponse, error) {
9393
if len(userIDs) == 0 {
94-
return nil, fmt.Errorf("userIDs parameter should not be empty")
94+
return nil, errors.New("userIDs parameter should not be empty")
9595
}
9696

9797
data := struct {

0 commit comments

Comments
 (0)