Skip to content

Commit

Permalink
fix to use build.Default.GOPATH instead of os.Getenv(GOPATH)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoh86 committed May 12, 2018
1 parent acdda8a commit d15c10c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/load.go
@@ -1,6 +1,7 @@
package config

import (
"go/build"
"io/ioutil"
"log"
"os"
Expand Down Expand Up @@ -38,7 +39,7 @@ func loadableSources() []string {

localOnly := os.Getenv(LocalOnlyEnvName)
if localOnly != "1" {
dirs = appendIndirect(dirs, getEnvPath("GOPATH"))
dirs = append(dirs, build.Default.GOPATH)
dirs = appendIndirect(dirs, getEnvPath("GOROOT"))
if xdgHome := xdg.ConfigHome(); xdgHome != "" {
dirs = append(dirs, xdgHome)
Expand Down
3 changes: 2 additions & 1 deletion editor/test/test.go
Expand Up @@ -2,6 +2,7 @@ package test

import (
"fmt"
"go/build"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (e *test) Edit(line string) (string, error) {
Exp: importpath,
Func: func(s string) string {
s = strings.TrimPrefix(s, `# `)
imported := filepath.Join(os.Getenv(`GOPATH`), `src`, s)
imported := filepath.Join(build.Default.GOPATH, `src`, s)
stat, err := os.Stat(imported)
if err != nil {
return s
Expand Down

0 comments on commit d15c10c

Please sign in to comment.