Skip to content

Commit

Permalink
Format code (#109)
Browse files Browse the repository at this point in the history
* Format code

* Fix gosec issue
  • Loading branch information
mhmxs committed Mar 1, 2023
1 parent 617a03e commit 3a6dd8a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
11 changes: 6 additions & 5 deletions api/v1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ import (
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.

// var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
var ctx context.Context
var cancel context.CancelFunc
var (
k8sClient client.Client
testEnv *envtest.Environment
ctx context.Context
cancel context.CancelFunc
)

func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down Expand Up @@ -124,7 +126,6 @@ var _ = BeforeSuite(func() {
conn.Close()
return nil
}).Should(Succeed())

}, 60)

var _ = AfterSuite(func() {
Expand Down
7 changes: 4 additions & 3 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ import (
// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.

// var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
var (
k8sClient client.Client
testEnv *envtest.Environment
)

func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down Expand Up @@ -69,7 +71,6 @@ var _ = BeforeSuite(func() {
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

}, 60)

var _ = AfterSuite(func() {
Expand Down
6 changes: 5 additions & 1 deletion pkg/diskinfo/frpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func getProxy(name, namespace string) (string, error) {
proxyPollLog.Error(err, "failed to call dashboard")
return
}
defer resp.Body.Close()
defer func() {
if err := resp.Body.Close(); err != nil {
proxyPollLog.Error(err, "failed to close body")
}
}()

content, err := io.ReadAll(resp.Body)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/semaphore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Semaphore func() (bool, func())

// CreateSemaphore creates a new semaphore to limit concurrency
func CreateSemaphore(concurrency int, wait time.Duration) Semaphore {
var lock = make(chan bool, concurrency)
lock := make(chan bool, concurrency)

return func() (bool, func()) {
timer := time.NewTimer(wait)
Expand Down

0 comments on commit 3a6dd8a

Please sign in to comment.