Skip to content

Commit 1cde3f3

Browse files
author
Eric Stroczynski
authored
hack/tests/scaffolding/scaffold-memcached.go: remove go.mod in SDK repo hack (#1665)
1 parent 68fde93 commit 1cde3f3

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

hack/tests/scaffolding/scaffold-memcached.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ func main() {
7878

7979
replace := getGoModReplace(localSDKPath)
8080
if replace.repo != sdkRepo {
81-
if replace.isLocal {
82-
// A hacky way to get local module substitution to work is to write a
83-
// stub go.mod into the local SDK repo referred to in
84-
// memcached-operator's go.mod, which allows go to recognize
85-
// the local SDK repo as a module.
86-
sdkModPath := filepath.Join(filepath.FromSlash(replace.repo), "go.mod")
87-
if _, err = os.Stat(sdkModPath); err != nil && os.IsNotExist(err) {
88-
err = ioutil.WriteFile(sdkModPath, []byte("module "+sdkRepo), fileutil.DefaultFileMode)
89-
if err != nil {
90-
log.Fatalf("Failed to write main repo go.mod file: %v", err)
91-
}
92-
}
93-
}
9481
modBytes, err := insertGoModReplace(sdkRepo, replace.repo, replace.ref)
9582
if err != nil {
9683
log.Fatalf("Failed to insert go.mod replace: %v", err)
@@ -207,9 +194,8 @@ func main() {
207194
}
208195

209196
type goModReplace struct {
210-
repo string
211-
ref string
212-
isLocal bool
197+
repo string
198+
ref string
213199
}
214200

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

262248
// Local environment
263249
return goModReplace{
264-
repo: localSDKPath,
265-
isLocal: true,
250+
repo: localSDKPath,
266251
}
267252
}
268253

0 commit comments

Comments
 (0)