Skip to content

Commit

Permalink
Added linting/vetting to GitHub CI (#14)
Browse files Browse the repository at this point in the history
* Added linting/vetting to GitHub CI
* Fixed some vet errors
  • Loading branch information
oxisto authored Feb 25, 2022
1 parent a531c27 commit 4347b01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ jobs:
with:
go-version: 1.17

- name: Lint
run: go vet ./...

- name: Build
run: go build -v ./...
run: go build ./...

- name: Test
run: go test -v -coverprofile=coverage.cov -coverpkg ./... -covermode=atomic ./...
Expand Down
10 changes: 8 additions & 2 deletions cmd/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ import (
)

func Test_main(t *testing.T) {
var wg sync.WaitGroup
var (
wg sync.WaitGroup
err error
)
wg.Add(1)

flag.Set("port", "0")
err = flag.Set("port", "0")
if err != nil {
t.Errorf("Error while setting flag: %v", err)
}

ctx = func(net.Listener) context.Context {
wg.Done()
Expand Down
8 changes: 0 additions & 8 deletions server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

func TestAuthorizationServer_handleToken(t *testing.T) {
type fields struct {
Server http.Server
clients []*Client
signingKey *ecdsa.PrivateKey
}
Expand Down Expand Up @@ -53,7 +52,6 @@ func TestAuthorizationServer_handleToken(t *testing.T) {
rr := httptest.NewRecorder()

srv := &AuthorizationServer{
Server: tt.fields.Server,
clients: tt.fields.clients,
signingKey: tt.fields.signingKey,
}
Expand All @@ -69,7 +67,6 @@ func TestAuthorizationServer_handleToken(t *testing.T) {

func TestAuthorizationServer_retrieveClient(t *testing.T) {
type fields struct {
Server http.Server
clients []*Client
signingKey *ecdsa.PrivateKey
}
Expand Down Expand Up @@ -149,7 +146,6 @@ func TestAuthorizationServer_retrieveClient(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
srv := &AuthorizationServer{
Server: tt.fields.Server,
clients: tt.fields.clients,
signingKey: tt.fields.signingKey,
}
Expand All @@ -167,7 +163,6 @@ func TestAuthorizationServer_retrieveClient(t *testing.T) {

func TestAuthorizationServer_handleJWKS(t *testing.T) {
type fields struct {
Server http.Server
clients []*Client
signingKey *ecdsa.PrivateKey
}
Expand Down Expand Up @@ -219,7 +214,6 @@ func TestAuthorizationServer_handleJWKS(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
srv := &AuthorizationServer{
Server: tt.fields.Server,
clients: tt.fields.clients,
signingKey: tt.fields.signingKey,
}
Expand Down Expand Up @@ -291,7 +285,6 @@ func Test_writeJSON(t *testing.T) {

func TestAuthorizationServer_doClientCredentialsFlow(t *testing.T) {
type fields struct {
Server http.Server
clients []*Client
signingKey *ecdsa.PrivateKey
}
Expand Down Expand Up @@ -363,7 +356,6 @@ func TestAuthorizationServer_doClientCredentialsFlow(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
srv := &AuthorizationServer{
Server: tt.fields.Server,
clients: tt.fields.clients,
signingKey: tt.fields.signingKey,
}
Expand Down

0 comments on commit 4347b01

Please sign in to comment.