Skip to content

Commit

Permalink
chore: introduce linter (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
varnastadeus authored Dec 9, 2022
1 parent b045c0f commit 072a3ec
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: golangci-lint
on:
pull_request:
permissions:
contents: read
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
5 changes: 3 additions & 2 deletions actions/check_node_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package actions

import (
"context"
"github.com/google/uuid"
"sync"
"testing"
"time"

"github.com/google/uuid"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -150,7 +151,7 @@ func TestCheckStatus_Ready(t *testing.T) {
go func() {
time.Sleep(1 * time.Second)
node.Status.Conditions[0].Status = v1.ConditionTrue
clientset.CoreV1().Nodes().Update(context.Background(), node, metav1.UpdateOptions{})
_, _ = clientset.CoreV1().Nodes().Update(context.Background(), node, metav1.UpdateOptions{})
wg.Done()
}()
wg.Wait()
Expand Down
5 changes: 2 additions & 3 deletions castai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package castai
import (
"context"
"fmt"
"net/http"
"time"

"github.com/go-resty/resty/v2"
Expand Down Expand Up @@ -38,8 +37,8 @@ func NewDefaultClient(url, key string, level logrus.Level, binVersion *config.Cl
client := resty.New()
client.SetHostURL(url)
client.SetTimeout(5 * time.Minute) // Hard timeout for any request.
client.Header.Set(http.CanonicalHeaderKey(headerAPIKey), key)
client.Header.Set(http.CanonicalHeaderKey(headerUserAgent), "castai-cluster-controller/"+binVersion.Version)
client.Header.Set(headerAPIKey, key)
client.Header.Set(headerUserAgent, "castai-cluster-controller/"+binVersion.Version)
if level == logrus.TraceLevel {
client.SetDebug(true)
}
Expand Down

0 comments on commit 072a3ec

Please sign in to comment.