Add golangci-lint workflow (#4999)
* fix lint workflow * add golang lint * close http response body
This commit is contained in:
@@ -210,6 +210,7 @@ func (d devopsOperator) ListDevOpsProject(workspace string, limit, offset int) (
|
||||
if err != nil {
|
||||
return api.ListResult{}, nil
|
||||
}
|
||||
//nolint:staticcheck,ineffassign
|
||||
items := make([]interface{}, 0)
|
||||
var result []interface{}
|
||||
for _, item := range data {
|
||||
@@ -550,7 +551,7 @@ func (d devopsOperator) GetNodesDetail(projectName, pipelineName, runId string,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Nodes, err := json.Marshal(respNodes)
|
||||
Nodes, _ := json.Marshal(respNodes)
|
||||
err = json.Unmarshal(Nodes, &nodesDetails)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
@@ -722,7 +723,7 @@ func (d devopsOperator) GetBranchNodesDetail(projectName, pipelineName, branchNa
|
||||
klog.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
Nodes, err := json.Marshal(respNodes)
|
||||
Nodes, _ := json.Marshal(respNodes)
|
||||
err = json.Unmarshal(Nodes, &nodesDetails)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
@@ -982,9 +983,9 @@ func getInputReqBody(reqBody io.ReadCloser) (newReqBody io.ReadCloser, err error
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(Body, &checkBody)
|
||||
json.Unmarshal(Body, &checkBody)
|
||||
|
||||
if checkBody.Abort != true && checkBody.Parameters == nil {
|
||||
if !checkBody.Abort && checkBody.Parameters == nil {
|
||||
workRound.Parameters = []devops.CheckPlayloadParameters{}
|
||||
workRound.ID = checkBody.ID
|
||||
jsonBody, _ = json.Marshal(workRound)
|
||||
|
||||
@@ -39,7 +39,6 @@ import (
|
||||
|
||||
const (
|
||||
fileaContents = "This is a test file."
|
||||
fileaKey = "binary"
|
||||
fileaName = "filea.txt"
|
||||
boundary = `MyBoundary`
|
||||
ns = "testns"
|
||||
@@ -63,6 +62,7 @@ func TestS2iBinaryUploader(t *testing.T) {
|
||||
informerFactory := ksinformers.NewSharedInformerFactory(fakeKubeClient, 0)
|
||||
stopCh := make(chan struct{})
|
||||
s2iInformer := informerFactory.Devops().V1alpha1().S2iBinaries()
|
||||
//nolint:ineffassign,staticcheck
|
||||
err := s2iInformer.Informer().GetIndexer().Add(s2ib)
|
||||
defer close(stopCh)
|
||||
informerFactory.Start(stopCh)
|
||||
|
||||
Reference in New Issue
Block a user