

def find_gopaths(self):
    'search for potential GOPATHs.'
    goroot = set((os.path.normpath(s) for s in os.environ.get('GOROOT', '').split(os.pathsep)))
    gopath = set((os.path.normpath(s) for s in os.environ.get('GOPATH', '').split(os.pathsep)))
    if ('.' in gopath):
        gopath.remove('.')
    gopath = list(gopath)
    dirparts = os.path.dirname(self.filename).split(os.sep)
    for i in range((len(dirparts) - 1), 1, (- 1)):
        if (dirparts[i].lower() != 'src'):
            continue
        p = os.path.normpath(os.sep.join(dirparts[:i]))
        if ((p not in goroot) and (p not in gopath)):
            gopath.append(p)
    if persist.debug_mode():
        persist.printf('{}: {} {}'.format(self.name, os.path.basename((self.filename or '<unsaved>')), ('guessed GOPATH=' + os.pathsep.join(gopath))))
    return os.pathsep.join(gopath)

dataset/ETHPy150Open sirreal/SublimeLinter-contrib-golint/linter.py Golint.find_gopaths/original