Skip to content

Commit cc75a11

Browse files
Merge pull request containerd#1484 from yanxuean/loadconfig
Improve server.LoadConfig function
2 parents 4943771 + 39b5f90 commit cc75a11

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"io"
66

77
"github.com/BurntSushi/toml"
8+
"github.com/containerd/containerd/errdefs"
9+
"github.com/pkg/errors"
810
)
911

1012
// Config provides containerd configuration data for the server
@@ -77,7 +79,7 @@ func (c *Config) WriteTo(w io.Writer) (int64, error) {
7779
// LoadConfig loads the containerd server config from the provided path
7880
func LoadConfig(path string, v *Config) error {
7981
if v == nil {
80-
v = &Config{}
82+
return errors.Wrapf(errdefs.ErrInvalidArgument, "argument v must not be nil")
8183
}
8284
md, err := toml.DecodeFile(path, v)
8385
if err != nil {

0 commit comments

Comments
 (0)