diff --git a/cue/load/search.go b/cue/load/search.go index 7d1e9fbfd03..c821d1b796d 100644 --- a/cue/load/search.go +++ b/cue/load/search.go @@ -188,9 +188,9 @@ func (l *loader) matchPackagesInFS(pattern, pkgName string) *match { // silently skipped as not matching the pattern. // Do not take root, as we want to stay relative // to one dir only. - relPath, e := filepath.Rel(c.Dir, path) - if e != nil { - panic(err) // Should never happen because c.Dir is absolute. + relPath, err2 := filepath.Rel(c.Dir, path) + if err2 != nil { + panic(err2) // Should never happen because c.Dir is absolute. } relPath = "./" + filepath.ToSlash(relPath) // TODO: consider not doing these checks here. @@ -199,8 +199,6 @@ func (l *loader) matchPackagesInFS(pattern, pkgName string) *match { for _, p := range pkgs { if err := p.Err; err != nil && (p == nil || len(p.InvalidFiles) == 0) { switch err.(type) { - case nil: - break case *NoFilesError: if c.DataFiles && len(p.OrphanedFiles) > 0 { break diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go index b68b906c70d..bd8bb5fc48f 100644 --- a/encoding/openapi/build.go +++ b/encoding/openapi/build.go @@ -1237,9 +1237,6 @@ func (b *builder) finish() *ast.StructLit { default: exprs := []ast.Expr{} - if t != nil { - exprs = append(exprs, (*ast.StructLit)(t)) - } for _, s := range b.allOf { exprs = append(exprs, s) } diff --git a/tools/flow/flow_test.go b/tools/flow/flow_test.go index 6979847ef92..7cb43f04c42 100644 --- a/tools/flow/flow_test.go +++ b/tools/flow/flow_test.go @@ -165,8 +165,7 @@ func taskFunc(v cue.Value) (flow.Runner, error) { t.Fill(map[string]string{"stdout": "foo"}) return nil }), nil - } - if err != nil && v.LookupPath(cue.MakePath(cue.Str("$id"))).Exists() { + } else if v.LookupPath(cue.MakePath(cue.Str("$id"))).Exists() { return nil, err }