Files
odo/tests/helper/helper_configValidate.go
Armel Soro 7b9f214299 Bump Go to 1.19 (#6586)
* Set Go version in go.mod

go mod edit -go=1.19

* Fix formatting issues reported by gofmt

* Fix SA1019 check (usage of deprecated "io/ioutil"), reported by golangci-lint

SA1019: "io/ioutil" has been deprecated since Go 1.16:
As of Go 1.16, the same functionality is now provided by package io or package os,
and those implementations should be preferred in new code.
See the specific function documentation for details. (staticcheck)

* Use Go 1.19 in our Dockerfiles

* Use Go 1.19 in the rpm-prepare.sh script

* Update the tag for the IBM Cloud CI image
2023-02-16 09:03:48 -05:00

24 lines
563 B
Go

package helper
import (
"fmt"
"os"
"path/filepath"
. "github.com/onsi/gomega"
)
// CreateLocalEnv creates a .odo/env/env.yaml file
// Useful for commands that require this file and cannot create one on their own, for e.g. url, list
func CreateLocalEnv(context, compName, projectName string) {
var config = fmt.Sprintf(`
ComponentSettings:
Name: %s
Project: %s
AppName: app
`, compName, projectName)
dir := filepath.Join(context, ".odo", "env")
MakeDir(dir)
Expect(os.WriteFile(filepath.Join(dir, "env.yaml"), []byte(config), 0600)).To(BeNil())
}