Skip to content

Commit 02db5ac

Browse files
committed
Add style job to ci.yml
1 parent 77cd330 commit 02db5ac

File tree

2 files changed

+32
-24
lines changed

2 files changed

+32
-24
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ jobs:
2323

2424
- name: Exit
2525
run: (exit 0)
26+
27+
style:
28+
name: Style
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Run formatting test
33+
run: test -z $(go fmt ./...)

internal/auth/auth_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
package auth
1+
package auth
22

33
import (
4-
"fmt"
5-
"net/http"
6-
"testing"
4+
"fmt"
5+
"net/http"
6+
"testing"
77
)
88

99
func TestGetAPIKey(t *testing.T) {
10-
tests := []struct{
11-
name string
12-
header http.Header
13-
want string
14-
wantErr bool
10+
tests := []struct {
11+
name string
12+
header http.Header
13+
want string
14+
wantErr bool
1515
}{
16-
{
17-
name: "missing auth header",
18-
header: http.Header{"Authorization": []string{""}},
19-
want: "",
20-
wantErr: true,
21-
},
16+
{
17+
name: "missing auth header",
18+
header: http.Header{"Authorization": []string{""}},
19+
want: "",
20+
wantErr: true,
21+
},
2222
}
2323

24-
for _, tc := range tests {
25-
got, err := GetAPIKey(tc.header)
26-
if (err != nil) != tc.wantErr {
27-
fmt.Sprintf("Got issue in test case %s", tc.name)
28-
t.Fatalf("expected error: %v, got %v", tc.wantErr, err)
24+
for _, tc := range tests {
25+
got, err := GetAPIKey(tc.header)
26+
if (err != nil) != tc.wantErr {
27+
fmt.Sprintf("Got issue in test case %s", tc.name)
28+
t.Fatalf("expected error: %v, got %v", tc.wantErr, err)
29+
}
30+
if got != tc.want {
31+
t.Errorf("expected: %q, got %q", tc.want, got)
32+
}
2933
}
30-
if got != tc.want {
31-
t.Errorf("expected: %q, got %q", tc.want, got)
32-
}
33-
}
3434
}

0 commit comments

Comments
 (0)