You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: root.go
    path of file: ./repos/istio/pkg/test/cert/ca
    
    the code of the file until where you have to start completion: //  Copyright Istio Authors
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicabl
    
func NewRoot(workDir string) (Root, error) {
	root := Root{
		KeyFile:  filepath.Join(workDir, "root-key.pem"),
		ConfFile: filepath.Join(workDir, "root-ca.conf"),
		CSRFile:  filepath.Join(workDir, "root-ca.csr"),
		CertFile: filepath.Join(workDir, "root-cert.pem"),
	}

	// Write out the conf file.
	if err := os.WriteFile(root.ConfFile, []byte(rootCAConf), os.ModePerm); err != nil {
		return Root{}, err
	}

	// Create the root key.
	if err := cert.GenerateKey(root.KeyFile); err != nil {
		return Root{}, err
	}

	// Create the root CSR
	if err := cert.GenerateCSR(root.ConfFile, root.KeyFile, root.CSRFile); err != nil {
		return Root{}, err
	}

	// Create the root cert
	if err := cert.GenerateCert(root.ConfFile, root.CSRFile, root.KeyFile, root.CertFile); err != nil {
		return Root{}, err
	}
	return root, nil
}