-2

I don't known why I can not get the path value. may be there something error or other, path = os.Getenv("GOMOD") // path is ""

1.project go env:

....
GOMOD="/home/lu/go/gowork/work/gt/go.mod"
...
  1. system go env:
...
GOMOD=""
...
Dreamlu
  • 21
  • 2

1 Answers1

1

I solve it: in golang code,

import "github.com/dreamlu/gt/tool/file/file_func"
path = file_func.ProjectPath()

print the path = "/home/lu/go/gowork/work/gt/go.mod"

Dreamlu
  • 21
  • 2