Skip to main content
Glama
goenv.go834 B
package goenv import ( "fmt" "os" "os/exec" "path/filepath" "strings" "sync" ) var ( goRootOnce sync.Once goRootPath string goRootErr error ) // GoRoot returns the system GOROOT by asking `go env GOROOT` once per process. func GoRoot() (string, error) { goRootOnce.Do(func() { cmd := exec.Command("go", "env", "GOROOT") cmd.Env = os.Environ() output, err := cmd.Output() if err != nil { goRootErr = fmt.Errorf("go env GOROOT: %w", err) return } goRootPath = strings.TrimSpace(string(output)) }) return goRootPath, goRootErr } // GoBin returns the path to the system Go toolchain's bin directory, if available. func GoBin() (string, error) { root, err := GoRoot() if err != nil { return "", err } if strings.TrimSpace(root) == "" { return "", nil } return filepath.Join(root, "bin"), nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hloiseaufcms/mcp-gopls'

If you have feedback or need assistance with the MCP directory API, please join our Discord server