Skip to content

Commit d3ebc81

Browse files
authored
Merge pull request github#8631 from github/cklin/merge-codeql-go
Merge codeql-go repository into codeql
2 parents 9b0d84c + 7f96319 commit d3ebc81

File tree

2,276 files changed

+199112
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,276 files changed

+199112
-13
lines changed

.codeqlmanifest.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"*/ql/examples/qlpack.yml",
77
"*/ql/consistency-queries/qlpack.yml",
88
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
9+
"go/ql/config/legacy-support/qlpack.yml",
10+
"go/build/codeql-extractor-go/codeql-extractor.yml",
911
"javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
1012
"javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml",
1113
"javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*.py text
4040
*.lua text
4141
*.expected text
42+
*.go text
4243

4344
# Explicitly set a bunch of known extensions to binary, because Git < 2.10 will treat
4445
# `* text=auto eol=lf` as `* text eol=lf`
@@ -52,6 +53,14 @@
5253
java/ql/test/stubs/**/*.java linguist-generated=true
5354
java/ql/test/experimental/stubs/**/*.java linguist-generated=true
5455

56+
# Force git not to modify line endings for go or html files under the go/ql directory
57+
go/ql/**/*.go -text
58+
go/ql/**/*.html -text
59+
# Force git not to modify line endings for go dbschemes
60+
go/*.dbscheme -text
61+
# Preserve unusual line ending from codeql-go merge
62+
go/extractor/opencsv/CSVReader.java -text
63+
5564
# For some languages, upgrade script testing references really old dbscheme
5665
# files from legacy upgrades that have CRLF line endings. Since upgrade
5766
# resolution relies on object hashes, we must suppress line ending conversion
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-query-format",
5+
"pattern": [
6+
{
7+
"regexp": "^((.*) would change by autoformatting\\.)$",
8+
"file": 2,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-syntax-check",
5+
"pattern": [
6+
{
7+
"regexp": "^((ERROR|WARNING): .* \\((.*):(\\d+),(\\d+)-\\d+\\))$",
8+
"message": 1,
9+
"file": 3,
10+
"line": 4,
11+
"col": 5,
12+
"severity": 2
13+
}
14+
]
15+
}
16+
]
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-test-run",
5+
"pattern": [
6+
{
7+
"regexp": "(\\[.*\\] FAILED\\((RESULT|COMPILATION)\\) (.*))$",
8+
"file": 3,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}

.github/problem-matchers/make.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "make",
5+
"pattern": [
6+
{
7+
"regexp": "^(make: \\*\\*\\* .*)$",
8+
"message": 1
9+
}
10+
]
11+
}
12+
]
13+
}

.github/workflows/go-tests.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: "Go: Run Tests"
2+
on: [pull_request]
3+
jobs:
4+
5+
test-linux:
6+
name: Test Linux (Ubuntu)
7+
runs-on: ubuntu-latest
8+
steps:
9+
10+
- name: Set up Go 1.18.1
11+
uses: actions/setup-go@v1
12+
with:
13+
go-version: 1.18.1
14+
id: go
15+
16+
- name: Set up CodeQL CLI
17+
run: |
18+
echo "Removing old CodeQL Directory..."
19+
rm -rf $HOME/codeql
20+
echo "Done"
21+
cd $HOME
22+
echo "Downloading CodeQL CLI..."
23+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
24+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
25+
echo "Done"
26+
echo "Unpacking CodeQL CLI..."
27+
unzip -q codeql-linux64.zip
28+
rm -f codeql-linux64.zip
29+
echo "Done"
30+
env:
31+
GITHUB_TOKEN: ${{ github.token }}
32+
33+
- name: Check out code
34+
uses: actions/checkout@v2
35+
36+
- name: Enable problem matchers in repository
37+
shell: bash
38+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
39+
40+
- name: Build
41+
run: |
42+
cd go
43+
env PATH=$PATH:$HOME/codeql make
44+
45+
- name: Check that all QL and Go code is autoformatted
46+
run: |
47+
cd go
48+
env PATH=$PATH:$HOME/codeql make check-formatting
49+
50+
- name: Compile qhelp files to markdown
51+
run: |
52+
cd go
53+
env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
54+
55+
- name: Upload qhelp markdown
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: qhelp-markdown
59+
path: go/qhelp-out/**/*.md
60+
61+
- name: Test
62+
run: |
63+
cd go
64+
env PATH=$PATH:$HOME/codeql make test
65+
66+
test-mac:
67+
name: Test MacOS
68+
runs-on: macOS-latest
69+
steps:
70+
- name: Set up Go 1.18.1
71+
uses: actions/setup-go@v1
72+
with:
73+
go-version: 1.18.1
74+
id: go
75+
76+
- name: Set up CodeQL CLI
77+
run: |
78+
echo "Removing old CodeQL Directory..."
79+
rm -rf $HOME/codeql
80+
echo "Done"
81+
cd $HOME
82+
echo "Downloading CodeQL CLI..."
83+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
84+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-osx64.zip "$LATEST"
85+
echo "Done"
86+
echo "Unpacking CodeQL CLI..."
87+
unzip -q codeql-osx64.zip
88+
rm -f codeql-osx64.zip
89+
echo "Done"
90+
env:
91+
GITHUB_TOKEN: ${{ github.token }}
92+
93+
- name: Check out code
94+
uses: actions/checkout@v2
95+
96+
- name: Enable problem matchers in repository
97+
shell: bash
98+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
99+
100+
- name: Build
101+
run: |
102+
cd go
103+
env PATH=$PATH:$HOME/codeql make
104+
105+
- name: Test
106+
run: |
107+
cd go
108+
env PATH=$PATH:$HOME/codeql make test
109+
110+
test-win:
111+
name: Test Windows
112+
runs-on: windows-2019
113+
steps:
114+
- name: Set up Go 1.18.1
115+
uses: actions/setup-go@v1
116+
with:
117+
go-version: 1.18.1
118+
id: go
119+
120+
- name: Set up CodeQL CLI
121+
run: |
122+
echo "Removing old CodeQL Directory..."
123+
rm -rf $HOME/codeql
124+
echo "Done"
125+
cd "$HOME"
126+
echo "Downloading CodeQL CLI..."
127+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
128+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-win64.zip "$LATEST"
129+
echo "Done"
130+
echo "Unpacking CodeQL CLI..."
131+
unzip -q -o codeql-win64.zip
132+
unzip -q -o codeql-win64.zip codeql/codeql.exe
133+
rm -f codeql-win64.zip
134+
echo "Done"
135+
env:
136+
GITHUB_TOKEN: ${{ github.token }}
137+
shell:
138+
bash
139+
140+
- name: Check out code
141+
uses: actions/checkout@v2
142+
143+
- name: Enable problem matchers in repository
144+
shell: bash
145+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
146+
147+
- name: Build
148+
run: |
149+
$Env:Path += ";$HOME\codeql"
150+
cd go
151+
make
152+
153+
- name: Test
154+
run: |
155+
$Env:Path += ";$HOME\codeql"
156+
cd go
157+
make test

.github/workflows/ql-for-ql-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
runs-on: ubuntu-latest
141141
strategy:
142142
matrix:
143-
folder: [cpp, csharp, java, javascript, python, ql, ruby, swift]
143+
folder: [cpp, csharp, java, javascript, python, ql, ruby, swift, go]
144144

145145
needs:
146146
- package

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
matrix:
2020
repo:
2121
- github/codeql
22-
- github/codeql-go
2322
runs-on: ubuntu-latest
2423
steps:
2524
- uses: actions/checkout@v3

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# qltest projects and artifacts
1010
*/ql/test/**/*.testproj
1111
*/ql/test/**/*.actual
12+
*/ql/test/**/go.sum
1213

1314
# Visual studio temporaries, except a file used by QL4VS
1415
.vs/*
@@ -42,3 +43,15 @@ csharp/extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
4243

4344
# CLion project files
4445
/.clwb
46+
47+
# Go build artifacts
48+
go/build/*
49+
50+
# Go binaries
51+
go/tools/bin
52+
go/tools/linux64
53+
go/tools/osx64
54+
go/tools/win64
55+
go/tools/tokenizer.jar
56+
go/main
57+

0 commit comments

Comments
 (0)