diff --git a/go.mod b/go.mod index 716fd3b7..b6325048 100644 --- a/go.mod +++ b/go.mod @@ -40,6 +40,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/studio-b12/gowebdav v0.0.0-20200303150724-9380631c29a1 go.etcd.io/bbolt v1.3.5 + go.uber.org/automaxprocs v1.3.0 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a golang.org/x/net v0.0.0-20200822124328-c89045814202 golang.org/x/sys v0.0.0-20200828194041-157a740278f4 diff --git a/go.sum b/go.sum index e8775489..b1e736c7 100644 --- a/go.sum +++ b/go.sum @@ -489,6 +489,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/automaxprocs v1.3.0 h1:II28aZoGdaglS5vVNnspf28lnZpXScxtIozx1lAjdb0= +go.uber.org/automaxprocs v1.3.0/go.mod h1:9CWT6lKIep8U41DDaPiH6eFscnTyjfTANNQNx6LrIcA= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= diff --git a/main.go b/main.go index 444edef3..976d0408 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,18 @@ // https://github.com/drakkan/sftpgo/blob/master/README.md package main // import "github.com/drakkan/sftpgo" -import "github.com/drakkan/sftpgo/cmd" +import ( + "fmt" + + "go.uber.org/automaxprocs/maxprocs" + + "github.com/drakkan/sftpgo/cmd" +) func main() { + if undo, err := maxprocs.Set(); err != nil { + fmt.Printf("error setting max procs: %v\n", err) + undo() + } cmd.Execute() }