Paul Lecuq
36c5d6f2ed
- web service with json support - web page - cron service to update database infos
32 lines
554 B
Go
32 lines
554 B
Go
package here
|
|
|
|
import (
|
|
"path/filepath"
|
|
)
|
|
|
|
// Current returns the Info representing the current Go module
|
|
func (h Here) Current() (Info, error) {
|
|
hp := &h
|
|
(&hp.curOnce).Do(func() {
|
|
b, err := run("go", "env", "GOMOD")
|
|
if err != nil {
|
|
hp.curErr = err
|
|
return
|
|
}
|
|
root := filepath.Dir(string(b))
|
|
i, err := h.Dir(root)
|
|
if err != nil {
|
|
hp.curErr = err
|
|
return
|
|
}
|
|
hp.current = i
|
|
})
|
|
|
|
return h.current, h.curErr
|
|
}
|
|
|
|
// Current returns the Info representing the current Go module
|
|
func Current() (Info, error) {
|
|
return New().Current()
|
|
}
|