diff --git a/internal/util/projutil/project_util.go b/internal/util/projutil/project_util.go index 3a7bf647587..2d44ed95d7e 100644 --- a/internal/util/projutil/project_util.go +++ b/internal/util/projutil/project_util.go @@ -21,6 +21,7 @@ import ( "path/filepath" "strings" + "github.com/operator-framework/operator-sdk/pkg/scaffold" "github.com/operator-framework/operator-sdk/pkg/scaffold/ansible" "github.com/operator-framework/operator-sdk/pkg/scaffold/helm" @@ -28,16 +29,13 @@ import ( "github.com/spf13/cobra" ) -const ( - SrcDir = "src" - mainFile = "./cmd/manager/main.go" - buildDockerfile = "./build/Dockerfile" -) - const ( GopathEnv = "GOPATH" + SrcDir = "src" ) +var mainFile = filepath.Join(scaffold.ManagerDir, scaffold.CmdFile) + // OperatorType - the type of operator type OperatorType = string @@ -57,7 +55,7 @@ const ( func MustInProjectRoot() { // if the current directory has the "./build/dockerfile" file, then it is safe to say // we are at the project root. - _, err := os.Stat(buildDockerfile) + _, err := os.Stat(filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile)) if err != nil { if os.IsNotExist(err) { log.Fatal("must run command in project root dir: project structure requires ./build/Dockerfile") diff --git a/test/e2e/memcached_test.go b/test/e2e/memcached_test.go index 3f08aa6724d..b5c0c27b96b 100644 --- a/test/e2e/memcached_test.go +++ b/test/e2e/memcached_test.go @@ -224,9 +224,12 @@ func TestMemcached(t *testing.T) { } // link local sdk to vendor if not in travis if repo == "" { - os.RemoveAll("vendor/github.com/operator-framework/operator-sdk/pkg") - os.Symlink(filepath.Join(gopath, "src/github.com/operator-framework/operator-sdk/pkg"), - "vendor/github.com/operator-framework/operator-sdk/pkg") + for _, dir := range []string{"pkg", "internal"} { + repoDir := filepath.Join("github.com/operator-framework/operator-sdk", dir) + vendorDir := filepath.Join("vendor", repoDir) + os.RemoveAll(vendorDir) + os.Symlink(filepath.Join(gopath, projutil.SrcDir, repoDir), vendorDir) + } } file, err := yamlutil.GenerateCombinedGlobalManifest()