MCPcopy
hub / github.com/tailscale/tailscale / Diff

Method Diff

tool/gocross/env.go:111–131  ·  view source on GitHub ↗

Diff returns a string describing the pending mutations to the environment.

()

Source from the content-addressed store, hash-verified

109
110// Diff returns a string describing the pending mutations to the environment.
111func (e *Environment) Diff() string {
112 lines := make([]string, 0, len(e.set)+len(e.unset))
113 for k, v := range e.set {
114 old, ok := e.init[k]
115 if ok {
116 lines = append(lines, fmt.Sprintf("%s=%s (was %s)", k, v, old))
117 } else {
118 lines = append(lines, fmt.Sprintf("%s=%s (was <nil>)", k, v))
119 }
120 }
121 for k := range e.unset {
122 old, ok := e.init[k]
123 if ok {
124 lines = append(lines, fmt.Sprintf("%s=<nil> (was %s)", k, old))
125 } else {
126 lines = append(lines, fmt.Sprintf("%s=<nil> (was <nil>)", k))
127 }
128 }
129 sort.Strings(lines)
130 return strings.Join(lines, "\n")
131}

Callers 15

TestFunnelCloseFunction · 0.80
TestListenServiceCloseFunction · 0.80
TestServeAuthFunction · 0.80
TestPeerCapabilitiesFunction · 0.80
TestServePostRoutesFunction · 0.80
TestDBFunction · 0.80
diffFunction · 0.80
TestPatchifyPeersChangedFunction · 0.80
TestUpgradeNodeFunction · 0.80
TestNetmapDisplayMessageFunction · 0.80

Calls 1

StringsMethod · 0.80

Tested by 15

TestFunnelCloseFunction · 0.64
TestListenServiceCloseFunction · 0.64
TestServeAuthFunction · 0.64
TestPeerCapabilitiesFunction · 0.64
TestServePostRoutesFunction · 0.64
TestDBFunction · 0.64
diffFunction · 0.64
TestPatchifyPeersChangedFunction · 0.64
TestUpgradeNodeFunction · 0.64
TestNetmapDisplayMessageFunction · 0.64