Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 8341ce0

Browse files
authored
Merge pull request #97 from max-schaefer/fix-frontend-errors
Fix a few compiler errors in tests
2 parents bc9c47a + dd9738f commit 8341ce0

7 files changed

Lines changed: 20 additions & 9 deletions

File tree

ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalFlowStep.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
| main.go:38:7:38:20 | composite literal | main.go:38:2:38:2 | definition of s |
8484
| main.go:39:2:39:3 | definition of s1 | main.go:40:18:40:19 | s1 |
8585
| main.go:39:8:39:25 | call to append | main.go:39:2:39:3 | definition of s1 |
86+
| main.go:40:2:40:3 | definition of s2 | main.go:43:9:43:10 | s2 |
87+
| main.go:40:8:40:23 | call to append | main.go:40:2:40:3 | definition of s2 |
8688
| main.go:41:2:41:3 | definition of s4 | main.go:42:10:42:11 | s4 |
8789
| main.go:41:8:41:21 | call to make | main.go:41:2:41:3 | definition of s4 |
8890
| strings.go:8:12:8:12 | argument corresponding to s | strings.go:8:12:8:12 | definition of s |

ql/test/library-tests/semmle/go/dataflow/FlowSteps/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ func main() {
3434
test1(test2()(), test2())
3535
}
3636

37-
func test9() {
37+
func test9() []int {
3838
s := []int{1, 2, 3}
3939
s1 := append(s, 4, 5, 6)
4040
s2 := append(s, s1...)
4141
s4 := make([]int, 4)
4242
copy(s, s4)
43+
return s2
4344
}

ql/test/query-tests/InconsistentCode/MistypedExponentiation/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ func main() {
2626
// than the xor operator and so the query doesn't see a constant on the left
2727
// hand side of ^.
2828
fmt.Println(nonconst()*10 ^ 9)
29+
30+
fmt.Println(mask)
2931
}

ql/test/query-tests/RedundantCode/DeadStoreOfLocal/DeadStoreOfLocal.expected

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
| testdata.go:268:2:268:2 | assignment to x | This definition of x is never used. |
2121
| testdata.go:309:2:309:2 | assignment to a | This definition of a is never used. |
2222
| testdata.go:321:2:321:2 | assignment to a | This definition of a is never used. |
23-
| testdata.go:385:3:385:3 | assignment to x | This definition of x is never used. |
24-
| testdata.go:430:3:430:3 | assignment to x | This definition of x is never used. |
23+
| testdata.go:387:3:387:3 | assignment to x | This definition of x is never used. |
2524
| testdata.go:432:3:432:3 | assignment to x | This definition of x is never used. |
26-
| testdata.go:439:2:439:2 | assignment to x | This definition of x is never used. |
27-
| testdata.go:486:3:486:3 | assignment to x | This definition of x is never used. |
28-
| testdata.go:540:3:540:3 | assignment to x | This definition of x is never used. |
29-
| testdata.go:578:4:578:4 | assignment to x | This definition of x is never used. |
25+
| testdata.go:434:3:434:3 | assignment to x | This definition of x is never used. |
26+
| testdata.go:441:2:441:2 | assignment to x | This definition of x is never used. |
27+
| testdata.go:488:3:488:3 | assignment to x | This definition of x is never used. |
28+
| testdata.go:542:3:542:3 | assignment to x | This definition of x is never used. |
29+
| testdata.go:580:4:580:4 | assignment to x | This definition of x is never used. |

ql/test/query-tests/RedundantCode/DeadStoreOfLocal/testdata.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ func _() {
381381
func _() {
382382
var x int
383383
switch b {
384+
case true:
385+
_ = x
384386
default:
385387
x = deadStore() // BAD
386388
fallthrough

ql/test/query-tests/Security/CWE-190/AllocationSizeOverflowGood2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
)
66

7-
func encryptValueGood(v interface{}) ([]byte, error) {
7+
func encryptValueGood2(v interface{}) ([]byte, error) {
88
jsonData, err := json.Marshal(v)
99
if err != nil {
1010
return nil, err

ql/test/query-tests/Security/CWE-295/DisabledCertificateCheck/tst.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

3-
import "testing"
3+
import (
4+
"crypto/tls"
5+
"net/http"
6+
"testing"
7+
)
48

59
func TestSomethingExciting(t *testing.T) {
610
transport := &http.Transport{

0 commit comments

Comments
 (0)