Skip to content

Commit c9061f4

Browse files
authored
Merge pull request github#3186 from shati-patel/51-move-go-docs
Docs: Copy "CodeQL for Go" docs into this repo
2 parents 6982522 + e83bee2 commit c9061f4

File tree

12 files changed

+699
-1
lines changed

12 files changed

+699
-1
lines changed

docs/language/learn-ql/go/ast.dot

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
digraph ast {
2+
graph [dpi=300];
3+
"x" [shape=rect];
4+
"y" [shape=rect];
5+
"x + y" [shape=rect];
6+
"(x + y)" [shape=rect];
7+
"z" [shape=rect];
8+
"(x + y) * z" [shape=rect];
9+
invis1 [style=invis];
10+
invis2 [style=invis];
11+
invis3 [style=invis];
12+
13+
"(x + y) * z" -> "(x + y)" [label=" 0"];
14+
"(x + y) * z" -> "z" [label=" 1"];
15+
"(x + y)" -> "x + y" [label=" 0"];
16+
"x + y" -> "x" [label=" 0"];
17+
"x + y" -> "y" [label=" 1"];
18+
19+
"z" -> invis1 [style=invis];
20+
invis1 -> invis2 [style=invis];
21+
invis1 -> invis3 [style=invis];
22+
}

docs/language/learn-ql/go/ast.png

45.4 KB
Loading

docs/language/learn-ql/go/cfg.dot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
digraph cfg {
2+
graph [dpi=300];
3+
rankdir=LR;
4+
"x := 0" -> "p != nil";
5+
"p != nil" -> "x = p.f";
6+
"p != nil" -> "return x";
7+
"x = p.f" -> "return x";
8+
}

docs/language/learn-ql/go/cfg.png

44.1 KB
Loading

docs/language/learn-ql/go/cfg2.dot

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
digraph cfg2 {
2+
graph [dpi=300];
3+
rankdir=LR;
4+
5+
"p != nil is true" [shape=box];
6+
"p != nil is false" [shape=box];
7+
8+
"x := 0" -> "p != nil";
9+
"p != nil" -> "p != nil is true";
10+
"p != nil is true" -> "x = p.f";
11+
"p != nil" -> "p != nil is false";
12+
"p != nil is false" -> "return x";
13+
"x = p.f" -> "return x";
14+
}

docs/language/learn-ql/go/cfg2.png

63.9 KB
Loading

docs/language/learn-ql/go/dfg.dot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
digraph dfg {
2+
graph [dpi=300];
3+
rankdir=LR;
4+
5+
"x" [shape=diamond];
6+
"return x" [label=<return <u>x</u>>];
7+
8+
"0" -> "x";
9+
"p.f" -> "x";
10+
"x" -> "return x";
11+
}

docs/language/learn-ql/go/dfg.png

34.1 KB
Loading

docs/language/learn-ql/go/introduce-libraries-go.rst

Lines changed: 621 additions & 0 deletions
Large diffs are not rendered by default.

docs/language/learn-ql/go/ql-for-go.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ CodeQL for Go
33

44
Experiment and learn how to write effective and efficient queries for CodeQL databases generated from Go codebases.
55

6+
.. toctree::
7+
:hidden:
8+
9+
introduce-libraries-go
10+
611
- `Basic Go query <https://lgtm.com/help/lgtm/console/ql-go-basic-example>`__: Learn to write and run a simple CodeQL query using LGTM.
712

8-
Other resources
13+
- :doc:`CodeQL library for Go <introduce-libraries-go>`: When you're analyzing a Go program, you can make use of the large collection of classes in the CodeQL library for Go.
14+
15+
Further reading
916
---------------
1017

1118
- For the queries used in LGTM, display a `Go query <https://lgtm.com/search?q=language%3Ago&t=rules>`__ and click **Open in query console** to see the code used to find alerts.

0 commit comments

Comments
 (0)