Skip to content

hack/tests/scaffolding/scaffold-memcached.go: remove go.mod in SDK repo hack #1665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions hack/tests/scaffolding/scaffold-memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ func main() {

replace := getGoModReplace(localSDKPath)
if replace.repo != sdkRepo {
if replace.isLocal {
// A hacky way to get local module substitution to work is to write a
// stub go.mod into the local SDK repo referred to in
// memcached-operator's go.mod, which allows go to recognize
// the local SDK repo as a module.
sdkModPath := filepath.Join(filepath.FromSlash(replace.repo), "go.mod")
if _, err = os.Stat(sdkModPath); err != nil && os.IsNotExist(err) {
err = ioutil.WriteFile(sdkModPath, []byte("module "+sdkRepo), fileutil.DefaultFileMode)
if err != nil {
log.Fatalf("Failed to write main repo go.mod file: %v", err)
}
}
}
modBytes, err := insertGoModReplace(sdkRepo, replace.repo, replace.ref)
if err != nil {
log.Fatalf("Failed to insert go.mod replace: %v", err)
Expand Down Expand Up @@ -207,9 +194,8 @@ func main() {
}

type goModReplace struct {
repo string
ref string
isLocal bool
repo string
ref string
}

// getGoModReplace returns a go.mod replacement that is appropriate based on the build's
Expand Down Expand Up @@ -261,8 +247,7 @@ func getGoModReplace(localSDKPath string) goModReplace {

// Local environment
return goModReplace{
repo: localSDKPath,
isLocal: true,
repo: localSDKPath,
}
}

Expand Down