Skip to content

Commit d49cbec

Browse files
committed
cmd/gonew: remove redundant parameter srcMod
Running AddModuleStmt to a Module will create/update the path to dstMod and ignore the srcMod if exists. So we do not need srcMod.
1 parent 97ea816 commit d49cbec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/gonew/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func main() {
150150
data = fixGo(data, rel, srcMod, dstMod, isRoot)
151151
}
152152
if rel == "go.mod" {
153-
data = fixGoMod(data, srcMod, dstMod)
153+
data = fixGoMod(data, dstMod)
154154
}
155155

156156
if err := os.WriteFile(dst, data, 0666); err != nil {
@@ -219,7 +219,7 @@ func fixGo(data []byte, file string, srcMod, dstMod string, isRoot bool) []byte
219219

220220
// fixGoMod rewrites the go.mod content in data to replace srcMod with dstMod
221221
// in the module path.
222-
func fixGoMod(data []byte, srcMod, dstMod string) []byte {
222+
func fixGoMod(data []byte, dstMod string) []byte {
223223
f, err := modfile.ParseLax("go.mod", data, nil)
224224
if err != nil {
225225
log.Fatalf("parsing source module:\n%s", err)

0 commit comments

Comments
 (0)