Skip to content

Commit ea2624d

Browse files
link.xknoneback
authored andcommitted
style(taskflow): remove unnecessary exported interface
1 parent 7be4cff commit ea2624d

4 files changed

Lines changed: 36 additions & 37 deletions

File tree

taskflow.go

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

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

75
// TaskFlow represents a series of tasks
86
type TaskFlow struct {

taskflow_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func TestTaskFlow(t *testing.T) {
106106
chains := newRgChain[string]()
107107
chains.grouping("C1", "A1", "B1", "A", "C")
108108
chains.grouping("B")
109+
109110
A.Precede(B)
110111
C.Precede(B)
111112
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)