version_go112.go (584B)
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. 4 5 //go:build go1.12 6 // +build go1.12 7 8 package acme 9 10 import "runtime/debug" 11 12 func init() { 13 // Set packageVersion if the binary was built in modules mode and x/crypto 14 // was not replaced with a different module. 15 info, ok := debug.ReadBuildInfo() 16 if !ok { 17 return 18 } 19 for _, m := range info.Deps { 20 if m.Path != "golang.org/x/crypto" { 21 continue 22 } 23 if m.Replace == nil { 24 packageVersion = m.Version 25 } 26 break 27 } 28 }