mirror of https://github.com/kubevela/kubevela.git
upgrade golang ci lint to 1.38.0 and fix lint error
This commit is contained in:
parent
f589471640
commit
1cdcf2ab48
|
@ -14,7 +14,7 @@ on:
|
|||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.14'
|
||||
GOLANGCI_VERSION: 'v1.31'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
DOCKER_BUILDX_VERSION: 'v0.4.2'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
|
|
|
@ -113,7 +113,6 @@ linters:
|
|||
- govet
|
||||
- gocyclo
|
||||
- gocritic
|
||||
- interfacer
|
||||
- goconst
|
||||
- goimports
|
||||
- gofmt # We enable this as well as goimports for its simplify mode.
|
||||
|
|
|
@ -59,6 +59,7 @@ func (c *CloneSetController) VerifySpec(ctx context.Context) (bool, error) {
|
|||
if verifyErr != nil {
|
||||
// do not fail the rollout because we can't get the resource
|
||||
c.rolloutStatus.RolloutRetry(verifyErr.Error())
|
||||
// nolint: nilerr
|
||||
return false, nil
|
||||
}
|
||||
// record the size
|
||||
|
|
|
@ -226,6 +226,7 @@ func (h *appHandler) createOrUpdateComponent(ctx context.Context, comp *v1alpha2
|
|||
checkForRevision := func() (bool, error) {
|
||||
if err := h.r.Get(ctx, compKey, &curComp); err != nil {
|
||||
// retry no matter what
|
||||
// nolint:nilerr
|
||||
return false, nil
|
||||
}
|
||||
if curComp.Status.LatestRevision == nil || curComp.Status.LatestRevision.Name == preRevisionName {
|
||||
|
@ -235,6 +236,7 @@ func (h *appHandler) createOrUpdateComponent(ctx context.Context, comp *v1alpha2
|
|||
compNameSpace, curComp.Status.LatestRevision.Name, &updatedComp.Spec)
|
||||
if err != nil {
|
||||
// retry no matter what
|
||||
// nolint:nilerr
|
||||
return false, nil
|
||||
}
|
||||
// end the loop if we find the revision
|
||||
|
|
|
@ -69,7 +69,7 @@ func (def *CapabilityComponentDefinition) GetCapabilityObject(ctx context.Contex
|
|||
}
|
||||
err := k8sClient.Get(ctx, objectKey, &componentDefinition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get ComponentDefinition %s: %v", def.Name, err)
|
||||
return nil, fmt.Errorf("failed to get ComponentDefinition %s: %w", def.Name, err)
|
||||
}
|
||||
def.ComponentDefinition = componentDefinition
|
||||
capability, err = util.ConvertTemplateJSON2Object(name, componentDefinition.Spec.Extension, componentDefinition.Spec.Schematic)
|
||||
|
|
|
@ -100,7 +100,7 @@ func openPrint(v cue.Value) (string, error) {
|
|||
sysopts := []cue.Option{cue.All(), cue.DisallowCycles(true), cue.ResolveReferences(true), cue.Docs(true)}
|
||||
f, err := sets.ToFile(v.Syntax(sysopts...))
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
for _, decl := range f.Decls {
|
||||
listOpen(decl)
|
||||
|
|
|
@ -191,7 +191,7 @@ func (o *VelaExecOptions) getPodName(compName string) (string, error) {
|
|||
}).String(),
|
||||
})
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
if podList != nil && len(podList.Items) == 0 {
|
||||
return "", fmt.Errorf("cannot get pods")
|
||||
|
|
|
@ -190,19 +190,19 @@ func generateSideBar(capabilities []types.Capability, docsPath string) error {
|
|||
return err
|
||||
}
|
||||
if _, err := f.WriteString("- Workload Types\n"); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
for _, w := range workloads {
|
||||
if _, err := f.WriteString(fmt.Sprintf(" - [%s](%s/%s.md)\n", w, plugins.WorkloadTypePath, w)); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
}
|
||||
if _, err := f.WriteString("- Traits\n"); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
for _, t := range traits {
|
||||
if _, err := f.WriteString(fmt.Sprintf(" - [%s](%s/%s.md)\n", t, plugins.TraitPath, t)); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -112,7 +112,7 @@ func ListApplications(ctx context.Context, c client.Reader, opt Option) ([]apis.
|
|||
}
|
||||
applicationMeta, err := RetrieveApplicationStatusByName(ctx, c, a.Name, a.Namespace)
|
||||
if err != nil {
|
||||
return applicationMetaList, nil
|
||||
return applicationMetaList, err
|
||||
}
|
||||
applicationMeta.Components = nil
|
||||
applicationMetaList = append(applicationMetaList, applicationMeta)
|
||||
|
|
|
@ -258,7 +258,7 @@ func (ref *MarkdownReference) CreateMarkdown(caps []types.Capability, baseRefPat
|
|||
}
|
||||
refContent = title + description + specification + refContent + conflictWithAndMoreSection
|
||||
if _, err := f.WriteString(refContent); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
return err
|
||||
|
@ -403,7 +403,7 @@ func (ref *MarkdownReference) generateConflictWithAndMore(capabilityName string,
|
|||
}
|
||||
data, err := ioutil.ReadFile(filepath.Clean(conflictWithFile))
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
return "\n" + string(data), nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue