aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorKévin Dunglas <[email protected]>2024-01-18 11:02:14 +0100
committerKévin Dunglas <[email protected]>2024-01-19 11:17:35 +0100
commitdba556fe4b8562dc236f09de6374c7809a7003ee (patch)
treede5c818c459981c1d7894a1369721469bb1a44a6 /cmd
parentd9aded016cc2e1ba5d70bf953030be70d2c15681 (diff)
downloadcaddy-dba556fe4b8562dc236f09de6374c7809a7003ee.tar.gz
caddy-dba556fe4b8562dc236f09de6374c7809a7003ee.zip
refactor: move automaxprocs init in caddycmd.Main()
Diffstat (limited to 'cmd')
-rw-r--r--cmd/caddy/main.go10
-rw-r--r--cmd/main.go7
2 files changed, 7 insertions, 10 deletions
diff --git a/cmd/caddy/main.go b/cmd/caddy/main.go
index e361e3bef..48fa149aa 100644
--- a/cmd/caddy/main.go
+++ b/cmd/caddy/main.go
@@ -29,22 +29,12 @@
package main
import (
- "go.uber.org/automaxprocs/maxprocs"
- "go.uber.org/zap"
-
caddycmd "github.com/caddyserver/caddy/v2/cmd"
- "github.com/caddyserver/caddy/v2"
// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
)
func main() {
- undo, err := maxprocs.Set()
- defer undo()
- if err != nil {
- caddy.Log().Warn("failed to set GOMAXPROCS", zap.Error(err))
- }
-
caddycmd.Main()
}
diff --git a/cmd/main.go b/cmd/main.go
index 73d70f04d..6fd58c62f 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -34,6 +34,7 @@ import (
"github.com/caddyserver/certmagic"
"github.com/spf13/pflag"
+ "go.uber.org/automaxprocs/maxprocs"
"go.uber.org/zap"
"github.com/caddyserver/caddy/v2"
@@ -64,6 +65,12 @@ func Main() {
os.Exit(caddy.ExitCodeFailedStartup)
}
+ undo, err := maxprocs.Set()
+ defer undo()
+ if err != nil {
+ caddy.Log().Warn("failed to set GOMAXPROCS", zap.Error(err))
+ }
+
if err := rootCmd.Execute(); err != nil {
var exitError *exitError
if errors.As(err, &exitError) {