dig icon indicating copy to clipboard operation
dig copied to clipboard

Child scope of container is not visualized on dot graph

Open greeflas opened this issue 1 year ago • 3 comments

Describe the bug Child scope of container is not visualized on dot graph.

To Reproduce

  1. Create container: c := dig.New()
  2. Provide the container with constructor: c.Provide(NewFirstComponent)
  3. Create child scope: child := c.Scope("test_scope")
  4. Provide the child scope with constructor: child.Provide(NewSecondComponent)
  5. Visualize container: dig.Visualize(c, os.Stdout)

Expected behavior I expect to see child scope along with NewSecondComponent but I only see NewFirstComponent.

Additional context Dig version: v1.17.1 Go Playground: https://go.dev/play/p/lhYAIUlfsPr DOT:

digraph {
	rankdir=RL;
	graph [compound=true];
	
		subgraph cluster_0 {
			label = "main";
			constructor_0 [shape=plaintext label="NewFirstComponent"];
			
			"*main.FirstComponent" [label=<*main.FirstComponent>];
			
		}
		
		
	
}

Graph image: graphviz (1)

greeflas avatar Jan 14 '24 13:01 greeflas

This is a valid feature request. I believe the DOT representation wasn't rewritten when we rewrote Dig's internal graph representation when we worked on the Scope feature.

sywhang avatar Jan 16 '24 06:01 sywhang

@sywhang should we close this issue or you want to add here info about future improvement that was discussed in pull request?

greeflas avatar Jan 18 '24 11:01 greeflas

I'll leave this open for now since we need some more visual improvements. Thanks

sywhang avatar Jan 18 '24 14:01 sywhang