Skip to content

Commit 2dfdd51

Browse files
Fixed typos and errors revealed by revision
Signed-off-by: Alessandro Carminati <[email protected]> Reported-by: Maurizio Papini <[email protected]>
1 parent 3f83743 commit 2dfdd51

10 files changed

+201
-227
lines changed

db_util.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ import (
1414

1515
type Datasource interface {
1616
init(arg interface{}) (err error)
17-
GetExploredSubsystemByName(subs string) (string)
17+
GetExploredSubsystemByName(subs string) string
1818
getSuccessorsById(symbolId int, instance int) ([]entry, error)
1919
getSubsysFromSymbolName(symbol string, instance int) (string, error)
2020
sym2num(symb string, instance int) (int, error)
2121
symbSubsys(symblist []int, instance int) (string, error)
22-
getEntryById(symbolId int, instance int) (entry, error)
22+
getEntryById(symbolId int, instance int) (entry, error)
2323
}
2424

25-
2625
const SUBSYS_UNDEF = "The REST"
2726

2827
// Parent node.
@@ -79,7 +78,6 @@ func removeDuplicate(list []entry) []entry {
7978
return res
8079
}
8180

82-
8381
// Checks if a given function needs to be explored.
8482
func notExcluded(symbol string, excluded []string) bool {
8583
for _, s := range excluded {
@@ -152,7 +150,7 @@ func navigate(d Datasource, symbolId int, parentDispaly node, targets []string,
152150
}
153151
}
154152
if notIn(*visited, curr.symId) {
155-
if (notExcluded(curr.symbol, excludedAfter) && notExcluded(curr.symbol, excludedBefore) ) && (maxdepth == 0 || ((maxdepth > 0) && (depth+depthInc < maxdepth))) {
153+
if (notExcluded(curr.symbol, excludedAfter) && notExcluded(curr.symbol, excludedBefore)) && (maxdepth == 0 || ((maxdepth > 0) && (depth+depthInc < maxdepth))) {
156154
navigate(d, curr.symId, ll, targets, visited, AdjMap, prod, instance, mode, excludedAfter, excludedBefore, depth+depthInc, maxdepth, dotFmt, output)
157155
}
158156
}
@@ -171,4 +169,3 @@ func intargets(targets []string, n1 string, n2 string) bool {
171169
}
172170
return false
173171
}
174-

db_util_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
var _ = Describe("Psql Tests", func() {
1313

14-
1514
AfterEach(func() {
1615
defer GinkgoRecover()
1716
})

dot_parser/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#DEBUG=-g
2-
#CC=gcc
3-
CC=clang-13
2+
CC=gcc
3+
#CC=clang-13
44

55
all: dotf
66
dot.tab.h: dot.y

go.sum

-11
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,8 @@ github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+q
5252
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
5353
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
5454
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
55-
<<<<<<< HEAD
5655
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
5756
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
58-
=======
59-
>>>>>>> 11c95d4 (address 'Uncontrolled Resource Consumption' warning)
6057
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6158
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
6259
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -78,13 +75,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
7875
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
7976
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
8077
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
81-
<<<<<<< HEAD
8278
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
8379
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
84-
=======
85-
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
86-
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
87-
>>>>>>> 11c95d4 (address 'Uncontrolled Resource Consumption' warning)
8880
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
8981
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
9082
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -120,7 +112,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
120112
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
121113
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
122114
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
123-
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
124115
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
125116
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
126117
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -131,8 +122,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
131122
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
132123
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
133124
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
134-
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
135-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
136125
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
137126
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
138127
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=

nav.go

+5-15
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
package main
77

88
import (
9-
"encoding/binary"
109
"bytes"
1110
"compress/gzip"
1211
"encoding/base64"
12+
"encoding/binary"
1313
"errors"
1414
"fmt"
1515
"nav/config"
1616
c "nav/constants"
17+
"github.com/goccy/go-graphviz"
1718
"os"
1819
"strings"
19-
"github.com/goccy/go-graphviz"
2020
)
2121

2222
const jsonOutputFMT string = "{\"graph\": \"%s\",\"graph_type\":\"%s\",\"symbols\": [%s]}"
@@ -97,7 +97,6 @@ func do_graphviz(dot string, output_type c.OutIMode) error{
9797
return errors.New("Unknown format")
9898
}
9999

100-
101100
graph, _ := graphviz.ParseBytes([]byte(dot))
102101
g := graphviz.New()
103102
defer func() {
@@ -111,13 +110,6 @@ func do_graphviz(dot string, output_type c.OutIMode) error{
111110
return nil
112111
}
113112

114-
func valid_dot(dot string) bool{
115-
if C.parse_string(C.CString(dot))==0 {
116-
return true
117-
}
118-
return false
119-
}
120-
121113
func generateOutput(d Datasource, cfg *config.Config) (string, error) {
122114
var graphOutput string
123115
var jsonOutput string
@@ -215,12 +207,10 @@ func main() {
215207
fmt.Printf("Unknown mode %s\n", conf.ConfValues.Type)
216208
os.Exit(-2)
217209
}
218-
219210
t := connectToken{conf.ConfValues.DBDriver, conf.ConfValues.DBDSN}
220-
221-
d:=&SqlDB{}
222-
err=d.init(&t)
223-
if err!= nil {
211+
d := &SqlDB{}
212+
err = d.init(&t)
213+
if err != nil {
224214
panic(err)
225215
}
226216

nav_cgo.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build CGO
12
// +build CGO
23

34
package main
@@ -18,9 +19,9 @@ int parse_string(const char* in) {
1819
*/
1920
import "C"
2021

21-
func valid_dot(dot string) bool{
22-
if C.parse_string(C.CString(dot))==0 {
22+
func valid_dot(dot string) bool {
23+
if C.parse_string(C.CString(dot)) == 0 {
2324
return true
24-
}
25+
}
2526
return false
2627
}

0 commit comments

Comments
 (0)