From 81698bbe0296d70ed886338aa943c28398c53f56 Mon Sep 17 00:00:00 2001 From: Doria Keung Date: Wed, 23 Oct 2024 12:15:05 -0400 Subject: [PATCH] Allow webpages to have an empty config (#3417) --- private/bufpkg/bufcobra/bufcobra.go | 1 - private/bufpkg/bufcobra/config.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/private/bufpkg/bufcobra/bufcobra.go b/private/bufpkg/bufcobra/bufcobra.go index 63f4f134d2..0fe058d428 100644 --- a/private/bufpkg/bufcobra/bufcobra.go +++ b/private/bufpkg/bufcobra/bufcobra.go @@ -77,7 +77,6 @@ func run( if err != nil { return err } - excludes := slicesext.ToStructMap(config.ExcludeCommands) for _, command := range cobraCommand.Commands() { if _, ok := excludes[command.CommandPath()]; ok { diff --git a/private/bufpkg/bufcobra/config.go b/private/bufpkg/bufcobra/config.go index e547876634..db9ed2dcc0 100644 --- a/private/bufpkg/bufcobra/config.go +++ b/private/bufpkg/bufcobra/config.go @@ -46,8 +46,9 @@ type config struct { } func readConfigFromFile(path string) (*config, error) { + var webpagesConfig config if path == "" { - return nil, nil + return &webpagesConfig, nil } file, err := os.Open(path) if err != nil { @@ -57,7 +58,6 @@ func readConfigFromFile(path string) (*config, error) { if err != nil { return nil, err } - var webpagesConfig config if err := yaml.Unmarshal(data, &webpagesConfig); err != nil { return nil, err }