github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/go/internal/modinfo/info.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package modinfo 6 7 import ( 8 "github.com/shogo82148/std/cmd/go/internal/modfetch/codehost" 9 "github.com/shogo82148/std/time" 10 ) 11 12 type ModulePublic struct { 13 Path string `json:",omitempty"` 14 Version string `json:",omitempty"` 15 Query string `json:",omitempty"` 16 Versions []string `json:",omitempty"` 17 Replace *ModulePublic `json:",omitempty"` 18 Time *time.Time `json:",omitempty"` 19 Update *ModulePublic `json:",omitempty"` 20 Main bool `json:",omitempty"` 21 Indirect bool `json:",omitempty"` 22 Dir string `json:",omitempty"` 23 GoMod string `json:",omitempty"` 24 GoVersion string `json:",omitempty"` 25 Retracted []string `json:",omitempty"` 26 Deprecated string `json:",omitempty"` 27 Error *ModuleError `json:",omitempty"` 28 Sum string `json:",omitempty"` 29 GoModSum string `json:",omitempty"` 30 Origin *codehost.Origin `json:",omitempty"` 31 Reuse bool `json:",omitempty"` 32 } 33 34 type ModuleError struct { 35 Err string 36 } 37 38 // UnmarshalJSON accepts both {"Err":"text"} and "text", 39 // so that the output of go mod download -json can still 40 // be unmarshaled into a ModulePublic during -reuse processing. 41 func (e *ModuleError) UnmarshalJSON(data []byte) error 42 43 func (m *ModulePublic) String() string