...
Source file src/pkg/cmd/go/internal/modinfo/info.go
1
2
3
4
5 package modinfo
6
7 import "time"
8
9
10
11
12 type ModulePublic struct {
13 Path string `json:",omitempty"`
14 Version string `json:",omitempty"`
15 Versions []string `json:",omitempty"`
16 Replace *ModulePublic `json:",omitempty"`
17 Time *time.Time `json:",omitempty"`
18 Update *ModulePublic `json:",omitempty"`
19 Main bool `json:",omitempty"`
20 Indirect bool `json:",omitempty"`
21 Dir string `json:",omitempty"`
22 GoMod string `json:",omitempty"`
23 GoVersion string `json:",omitempty"`
24 Error *ModuleError `json:",omitempty"`
25 }
26
27 type ModuleError struct {
28 Err string
29 }
30
31 func (m *ModulePublic) String() string {
32 s := m.Path
33 if m.Version != "" {
34 s += " " + m.Version
35 if m.Update != nil {
36 s += " [" + m.Update.Version + "]"
37 }
38 }
39 if m.Replace != nil {
40 s += " => " + m.Replace.Path
41 if m.Replace.Version != "" {
42 s += " " + m.Replace.Version
43 if m.Replace.Update != nil {
44 s += " [" + m.Replace.Update.Version + "]"
45 }
46 }
47 }
48 return s
49 }
50
View as plain text