From a2b92f6bf1a07cb6d0061d1d1822b66c7148ae76 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Sun, 7 Jan 2024 10:35:30 +0800 Subject: [PATCH] GOPMOD, GOMOD --- mod.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mod.go b/mod.go index 3a9af02..aae3ea9 100644 --- a/mod.go +++ b/mod.go @@ -45,4 +45,17 @@ func FindGoMod(dirFrom string) (dir, file string, err error) { return } +func GOMOD(dirFrom string) (file string, err error) { + _, file, err = FindGoMod(dirFrom) + return +} + +func GOPMOD(dirFrom string) (file string, err error) { + dir, _, err := FindGoMod(dirFrom) + if err != nil { + return + } + return filepath.Join(dir, "gop.mod"), nil +} + // -----------------------------------------------------------------------------