xref: /unit/test/unit/check/go.py (revision 1621:275b26bbd3ae)
1import os
2import subprocess
3
4
5def check_go(current_dir, temp_dir, test_dir):
6    if not os.path.exists(temp_dir + '/go'):
7        os.mkdir(temp_dir + '/go')
8
9    env = os.environ.copy()
10    env['GOPATH'] = current_dir + '/build/go'
11
12    try:
13        process = subprocess.Popen(
14            [
15                'go',
16                'build',
17                '-o',
18                temp_dir + '/go/app',
19                test_dir + '/go/empty/app.go',
20            ],
21            env=env,
22        )
23        process.communicate()
24
25        if process.returncode == 0:
26            return True
27
28    except:
29        return None
30