1 // Copyright 2019 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.
15 func printBuildInfo(w io.Writer, verbose bool, mode PrintMode) {
16 if info, ok := debug.ReadBuildInfo(); ok {
17 fmt.Fprintf(w, "%v %v\n", info.Path, Version)
18 printModuleInfo(w, &info.Main, mode)
20 for _, dep := range info.Deps {
21 printModuleInfo(w, dep, mode)
25 fmt.Fprintf(w, "version %s, built in $GOPATH mode\n", Version)
29 func printModuleInfo(w io.Writer, m *debug.Module, mode PrintMode) {
30 fmt.Fprintf(w, " %s@%s", m.Path, m.Version)
32 fmt.Fprintf(w, " %s", m.Sum)
35 fmt.Fprintf(w, " => %v", m.Replace.Path)