Skip to content

Commit c005200

Browse files
committed
Go: Install integration test dependencies to local GOPATH
1 parent afc6733 commit c005200

File tree

20 files changed

+202
-20
lines changed

20 files changed

+202
-20
lines changed
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
12+
613
run_codeql_database_create([], lang="go", source="src")
714

815
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
12+
613
run_codeql_database_create([], lang="go", source="src")
714

815
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['LGTM_INDEX_IMPORT_PATH'] = "test"
713
run_codeql_database_create([], lang="go", source="work", db=None)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45
from diagnostics_test_utils import *
56

7+
# Set up a GOPATH relative to this test's root directory;
8+
# we set os.environ instead of using extra_env because we
9+
# need it to be set for the call to "go clean -modcache" later
10+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
11+
os.environ['GOPATH'] = goPath
612
os.environ['GITHUB_REPOSITORY'] = "a/b"
713
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
814

915
check_diagnostics()
16+
17+
# Clean up the temporary GOPATH
18+
subprocess.call(["go", "clean", "-modcache"])
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import sys
1+
import os
2+
import subprocess
23

34
from create_database_utils import *
45

6+
# Set up a GOPATH relative to this test's root directory;
7+
# we set os.environ instead of using extra_env because we
8+
# need it to be set for the call to "go clean -modcache" later
9+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
10+
os.environ['GOPATH'] = goPath
511
run_codeql_database_create([], lang="go", source="src")
12+
13+
# Clean up the temporary GOPATH
14+
subprocess.call(["go", "clean", "-modcache"])

0 commit comments

Comments
 (0)