Skip to content

Commit 27efd16

Browse files
authored
style(taskflow): remove unnecessary exported interface (#101)
1 parent 1986e09 commit 27efd16

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

taskflow.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package gotaskflow
22

3-
import "io"
3+
import (
4+
"io"
5+
)
46

57
// TaskFlow represents a series of tasks
68
type TaskFlow struct {

taskflow_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ func TestTaskFlow(t *testing.T) {
106106
chains := newRgChain[string]()
107107
chains.grouping("C1", "A1", "B1", "A", "C")
108108
chains.grouping("B")
109-
110109
A.Precede(B)
111110
C.Precede(B)
112111
A1.Precede(B)

visualizer_dot.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,57 @@ import (
88

99
type dotVizer struct{}
1010

11-
// DotGraph represents a graph in DOT format
12-
type DotGraph struct {
11+
// dotGraph represents a graph in DOT format
12+
type dotGraph struct {
1313
name string
1414
isSubgraph bool
15-
nodes map[string]*DotNode
16-
edges []*DotEdge
15+
nodes map[string]*dotNode
16+
edges []*dotEdge
1717
attributes map[string]string
18-
subgraphs []*DotGraph
18+
subgraphs []*dotGraph
1919
indent string
2020
}
2121

22-
// DotNode represents a node in DOT format
23-
type DotNode struct {
22+
// dotNode represents a node in DOT format
23+
type dotNode struct {
2424
id string
2525
attributes map[string]string
2626
}
2727

28-
// DotEdge represents an edge in DOT format
29-
type DotEdge struct {
30-
from *DotNode
31-
to *DotNode
28+
// dotEdge represents an edge in DOT format
29+
type dotEdge struct {
30+
from *dotNode
31+
to *dotNode
3232
attributes map[string]string
3333
}
3434

35-
func newDotGraph(name string) *DotGraph {
36-
return &DotGraph{
35+
func newDotGraph(name string) *dotGraph {
36+
return &dotGraph{
3737
name: name,
3838
isSubgraph: false,
39-
nodes: make(map[string]*DotNode),
40-
edges: make([]*DotEdge, 0),
39+
nodes: make(map[string]*dotNode),
40+
edges: make([]*dotEdge, 0),
4141
attributes: make(map[string]string),
42-
subgraphs: make([]*DotGraph, 0),
42+
subgraphs: make([]*dotGraph, 0),
4343
indent: "",
4444
}
4545
}
4646

47-
func (g *DotGraph) CreateNode(name string) *DotNode {
47+
func (g *dotGraph) CreateNode(name string) *dotNode {
4848
if node, exists := g.nodes[name]; exists {
4949
return node
5050
}
5151

52-
node := &DotNode{
52+
node := &dotNode{
5353
id: name,
5454
attributes: make(map[string]string),
5555
}
5656
g.nodes[name] = node
5757
return node
5858
}
5959

60-
func (g *DotGraph) CreateEdge(from, to *DotNode, label string) *DotEdge {
61-
edge := &DotEdge{
60+
func (g *dotGraph) CreateEdge(from, to *dotNode, label string) *dotEdge {
61+
edge := &dotEdge{
6262
from: from,
6363
to: to,
6464
attributes: make(map[string]string),
@@ -70,21 +70,21 @@ func (g *DotGraph) CreateEdge(from, to *DotNode, label string) *DotEdge {
7070
return edge
7171
}
7272

73-
func (g *DotGraph) SubGraph(name string) *DotGraph {
74-
subgraph := &DotGraph{
73+
func (g *dotGraph) SubGraph(name string) *dotGraph {
74+
subgraph := &dotGraph{
7575
name: name,
7676
isSubgraph: true,
77-
nodes: make(map[string]*DotNode),
78-
edges: make([]*DotEdge, 0),
77+
nodes: make(map[string]*dotNode),
78+
edges: make([]*dotEdge, 0),
7979
attributes: make(map[string]string),
80-
subgraphs: make([]*DotGraph, 0),
80+
subgraphs: make([]*dotGraph, 0),
8181
indent: g.indent + " ",
8282
}
8383
g.subgraphs = append(g.subgraphs, subgraph)
8484
return subgraph
8585
}
8686

87-
func (g *DotGraph) String() string {
87+
func (g *dotGraph) String() string {
8888
var sb strings.Builder
8989

9090
if g.isSubgraph {
@@ -113,7 +113,7 @@ func (g *DotGraph) String() string {
113113
return sb.String()
114114
}
115115

116-
func (node *DotNode) Format(indent string) string {
116+
func (node *dotNode) Format(indent string) string {
117117
attrs := formatAttributes(node.attributes)
118118

119119
if attrs == "" {
@@ -123,7 +123,7 @@ func (node *DotNode) Format(indent string) string {
123123
return indent + quote(node.id) + " [" + attrs + "];\n"
124124
}
125125

126-
func (edge *DotEdge) Format(indent string) string {
126+
func (edge *dotEdge) Format(indent string) string {
127127
from := edge.from.id
128128
to := edge.to.id
129129

@@ -153,11 +153,11 @@ func formatAttributes(attrs map[string]string) string {
153153
}
154154

155155
// visualizeG recursively visualizes the graph and its subgraphs in DOT format
156-
func (v *dotVizer) visualizeG(g *eGraph, parentGraph *DotGraph) error {
156+
func (v *dotVizer) visualizeG(g *eGraph, parentGraph *dotGraph) error {
157157
graph := parentGraph
158158
graph.attributes["rankdir"] = "LR"
159159

160-
nodeMap := make(map[string]*DotNode)
160+
nodeMap := make(map[string]*dotNode)
161161

162162
for _, node := range g.nodes {
163163
color := "black"

visualizer_dot_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func TestDotVizer_VisualizeComplex(t *testing.T) {
159159
}
160160

161161
func TestDotNode_Format(t *testing.T) {
162-
node := &DotNode{
162+
node := &dotNode{
163163
id: "test_node",
164164
attributes: make(map[string]string),
165165
}
@@ -179,10 +179,10 @@ func TestDotNode_Format(t *testing.T) {
179179
}
180180

181181
func TestDotEdge_Format(t *testing.T) {
182-
from := &DotNode{id: "from"}
183-
to := &DotNode{id: "to"}
182+
from := &dotNode{id: "from"}
183+
to := &dotNode{id: "to"}
184184

185-
edge := &DotEdge{
185+
edge := &dotEdge{
186186
from: from,
187187
to: to,
188188
attributes: make(map[string]string),

0 commit comments

Comments
 (0)