mirror of https://github.com/databricks/cli.git
Add more rules for 'govet'. Fix issues found by nilness
bundle/run/job.go:206:25: nilness: tautological condition: non-nil != nil (govet) if err != nil && runId != nil { ^ cmd/labs/project/entrypoint.go:193:29: nilness: impossible condition: nil != nil (govet) if !isNoLoginConfig && err != nil { ^ libs/template/renderer.go:313:10: nilness: tautological condition: non-nil != nil (govet) if err != nil && !errors.Is(err, fs.ErrNotExist) { ^ make: *** [lint] Error 1
This commit is contained in:
parent
4d09480b7d
commit
1fc109edce
|
@ -10,6 +10,11 @@ linters:
|
||||||
- unused
|
- unused
|
||||||
- gofmt
|
- gofmt
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
govet:
|
||||||
|
enable-all: true
|
||||||
|
disable:
|
||||||
|
- fieldalignment
|
||||||
|
- shadow
|
||||||
gofmt:
|
gofmt:
|
||||||
rewrite-rules:
|
rewrite-rules:
|
||||||
- pattern: 'a[b:len(a)]'
|
- pattern: 'a[b:len(a)]'
|
||||||
|
|
|
@ -203,7 +203,7 @@ func (r *jobRunner) Run(ctx context.Context, opts *Options) (output.RunOutput, e
|
||||||
logDebug(r)
|
logDebug(r)
|
||||||
logProgress(r)
|
logProgress(r)
|
||||||
}).GetWithTimeout(jobRunTimeout)
|
}).GetWithTimeout(jobRunTimeout)
|
||||||
if err != nil && runId != nil {
|
if err != nil {
|
||||||
r.logFailedTasks(ctx, *runId)
|
r.logFailedTasks(ctx, *runId)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -190,9 +190,6 @@ func (e *Entrypoint) getLoginConfig(cmd *cobra.Command) (*loginConfig, *config.C
|
||||||
if isNoLoginConfig && !e.IsBundleAware {
|
if isNoLoginConfig && !e.IsBundleAware {
|
||||||
return nil, nil, ErrNoLoginConfig
|
return nil, nil, ErrNoLoginConfig
|
||||||
}
|
}
|
||||||
if !isNoLoginConfig && err != nil {
|
|
||||||
return nil, nil, fmt.Errorf("load: %w", err)
|
|
||||||
}
|
|
||||||
if e.IsAccountLevel {
|
if e.IsAccountLevel {
|
||||||
log.Debugf(ctx, "Using account-level login profile: %s", lc.AccountProfile)
|
log.Debugf(ctx, "Using account-level login profile: %s", lc.AccountProfile)
|
||||||
cfg, err := e.envAwareConfigWithProfile(ctx, lc.AccountProfile)
|
cfg, err := e.envAwareConfigWithProfile(ctx, lc.AccountProfile)
|
||||||
|
|
|
@ -310,7 +310,7 @@ func (r *renderer) persistToDisk(ctx context.Context, out filer.Filer) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return fmt.Errorf("failed to initialize template, one or more files already exist: %s", path)
|
return fmt.Errorf("failed to initialize template, one or more files already exist: %s", path)
|
||||||
}
|
}
|
||||||
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
if !errors.Is(err, fs.ErrNotExist) {
|
||||||
return fmt.Errorf("error while verifying file %s does not already exist: %w", path, err)
|
return fmt.Errorf("error while verifying file %s does not already exist: %w", path, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue