Skip to content

Commit 2ce77cf

Browse files
committed
use scaffold and projutil constants
1 parent b810387 commit 2ce77cf

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

internal/util/projutil/project_util.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,21 @@ import (
2121
"path/filepath"
2222
"strings"
2323

24+
"github.com/operator-framework/operator-sdk/pkg/scaffold"
2425
"github.com/operator-framework/operator-sdk/pkg/scaffold/ansible"
2526
"github.com/operator-framework/operator-sdk/pkg/scaffold/helm"
2627

2728
log "github.com/sirupsen/logrus"
2829
"github.com/spf13/cobra"
2930
)
3031

31-
const (
32-
SrcDir = "src"
33-
mainFile = "./cmd/manager/main.go"
34-
buildDockerfile = "./build/Dockerfile"
35-
)
36-
3732
const (
3833
GopathEnv = "GOPATH"
34+
SrcDir = "src"
3935
)
4036

37+
var mainFile = filepath.Join(scaffold.ManagerDir, scaffold.CmdFile)
38+
4139
// OperatorType - the type of operator
4240
type OperatorType = string
4341

@@ -57,7 +55,7 @@ const (
5755
func MustInProjectRoot() {
5856
// if the current directory has the "./build/dockerfile" file, then it is safe to say
5957
// we are at the project root.
60-
_, err := os.Stat(buildDockerfile)
58+
_, err := os.Stat(filepath.Join(scaffold.BuildDir, scaffold.DockerfileFile))
6159
if err != nil {
6260
if os.IsNotExist(err) {
6361
log.Fatal("must run command in project root dir: project structure requires ./build/Dockerfile")

test/e2e/memcached_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func TestMemcached(t *testing.T) {
228228
repoDir := filepath.Join("github.com/operator-framework/operator-sdk", dir)
229229
vendorDir := filepath.Join("vendor", repoDir)
230230
os.RemoveAll(vendorDir)
231-
os.Symlink(filepath.Join(gopath, "src", repoDir), vendorDir)
231+
os.Symlink(filepath.Join(gopath, projutil.SrcDir, repoDir), vendorDir)
232232
}
233233
}
234234

0 commit comments

Comments
 (0)