Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 19, 2024
1 parent e4b3be2 commit 69a99ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
4 changes: 2 additions & 2 deletions apps/cnquery/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var rootCmd = &cobra.Command{
Short: "cnquery CLI",
Long: theme.DefaultTheme.Landing + "\n\n" + rootCmdDesc,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
initLogger(cmd)
initLogger()
},
}

Expand Down Expand Up @@ -122,7 +122,7 @@ func init() {
config.Init(rootCmd)
}

func initLogger(cmd *cobra.Command) {
func initLogger() {
// environment variables always over-write custom flags
envLevel, ok := logger.GetEnvLogLevel()
if ok {
Expand Down
20 changes: 1 addition & 19 deletions providers/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http"
"net/url"
"os"
osfs "os"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -62,23 +61,6 @@ func init() {
// Initialize the global coordinator instance
coordinator := newCoordinator()
Coordinator = coordinator

// Load the schema for all the active providers
// FIXME: dynamically load providers on startup
providers, err := ListActive()
if err != nil {
log.Error().Err(err).Msg("failed to list active providers")
return
}

for name := range providers {
schema, err := Coordinator.LoadSchema(name)
if err != nil {
log.Error().Err(err).Str("provider", name).Msg("failed to load schema")
continue
}
coordinator.schema.Add(name, schema)
}
}

type ProviderLookup struct {
Expand Down Expand Up @@ -849,7 +831,7 @@ func MustLoadSchema(name string, data []byte) *resources.Schema {
}

func MustLoadSchemaFromFile(name string, path string) *resources.Schema {
raw, err := osfs.ReadFile(path)
raw, err := os.ReadFile(path)
if err != nil {
panic("cannot read schema file: " + path)
}
Expand Down

0 comments on commit 69a99ba

Please sign in to comment.