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 8package testenv 9 10import "runtime/debug" 11 12func packageMainIsDevelModule() bool { 13 info, ok := debug.ReadBuildInfo() 14 if !ok { 15 // Most test binaries currently lack build info, but this should become more 16 // permissive once https://golang.org/issue/33976 is fixed. 17 return true 18 } 19 20 // Note: info.Main.Version describes the version of the module containing 21 // package main, not the version of “the main module”. 22 // See https://golang.org/issue/33975. 23 return info.Main.Version == "(devel)" 24} 25 26func init() { 27 packageMainIsDevel = packageMainIsDevelModule 28} 29