Skip to content

Commit 9ea9ffb

Browse files
authored
Migrate to golang-jwt (#1)
1 parent 3190c38 commit 9ea9ffb

38 files changed

+298
-252
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fixes issue: AB#xxx
2+
3+
#### Description
4+
5+
#### Checklist
6+
7+
- [ ] I have resolved all the comments, either here or in real life
8+
- [ ] I have added automated tests that cover the new behaviour and removed obsolete tests and code

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gomod" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["main", "master"]
6+
pull_request:
7+
branches: ["main", "master"]
8+
9+
env:
10+
GO111MODULE: on
11+
GO_VERSION: "1.19"
12+
LINTER_VERSION: "1.50.1"
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Install Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: ${{ env.GO_VERSION }}.x
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
- name: Run linters
25+
uses: golangci/golangci-lint-action@v2
26+
with:
27+
# Required: the version of golangci-lint is required and must be specified without patch version: they always use the latest patch version.
28+
version: v${{ env.LINTER_VERSION }}
29+
# enable gofmt to check formatting issues
30+
args: --enable gofmt
31+
# show only new issues if it's a pull request. The default value is `false`.
32+
only-new-issues: true
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Install Go
38+
uses: actions/setup-go@v2
39+
with:
40+
go-version: ${{ env.GO_VERSION }}.x
41+
- name: Checkout code
42+
uses: actions/checkout@v2
43+
- name: Run tests
44+
run: go test -count=1 ./...

bulk/bulk_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package bulk
22

33
import (
4-
"io/ioutil"
4+
"io"
55
"net/http"
66
"reflect"
77
"strings"
@@ -74,7 +74,7 @@ func TestResource_CreateJob(t *testing.T) {
7474
return &http.Response{
7575
StatusCode: 500,
7676
Status: "Invalid URL",
77-
Body: ioutil.NopCloser(strings.NewReader(req.URL.String())),
77+
Body: io.NopCloser(strings.NewReader(req.URL.String())),
7878
Header: make(http.Header),
7979
}
8080
}
@@ -99,7 +99,7 @@ func TestResource_CreateJob(t *testing.T) {
9999
return &http.Response{
100100
StatusCode: http.StatusOK,
101101
Status: "Good",
102-
Body: ioutil.NopCloser(strings.NewReader(resp)),
102+
Body: io.NopCloser(strings.NewReader(resp)),
103103
Header: make(http.Header),
104104
}
105105

@@ -141,7 +141,7 @@ func TestResource_AllJobs(t *testing.T) {
141141
return &http.Response{
142142
StatusCode: 500,
143143
Status: "Invalid URL",
144-
Body: ioutil.NopCloser(strings.NewReader(req.URL.String())),
144+
Body: io.NopCloser(strings.NewReader(req.URL.String())),
145145
Header: make(http.Header),
146146
}
147147
}
@@ -171,7 +171,7 @@ func TestResource_AllJobs(t *testing.T) {
171171
return &http.Response{
172172
StatusCode: http.StatusOK,
173173
Status: "Good",
174-
Body: ioutil.NopCloser(strings.NewReader(resp)),
174+
Body: io.NopCloser(strings.NewReader(resp)),
175175
Header: make(http.Header),
176176
}
177177
}),

bulk/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ func (j *Job) UnprocessedRecords() ([]UnprocessedRecord, error) {
558558
}
559559

560560
func (j *Job) recordResultHeader(scanner *bufio.Scanner, delimiter string) ([]string, error) {
561-
if scanner.Scan() == false {
561+
if !scanner.Scan() {
562562
return nil, errors.New("job: response needs to have header")
563563
}
564564
text := strings.Replace(scanner.Text(), "\"", "", -1)

0 commit comments

Comments
 (0)