mirror of
https://github.com/golang/go
synced 2024-11-05 17:46:16 -07:00
c17b040389
Fixes golang/go#33950 Change-Id: Iefcb757e773bc052793611c099c25a457fd7e243 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192400 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com>
28 lines
742 B
Go
28 lines
742 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build go1.12
|
|
|
|
package testenv
|
|
|
|
import "runtime/debug"
|
|
|
|
func packageMainIsDevelModule() bool {
|
|
info, ok := debug.ReadBuildInfo()
|
|
if !ok {
|
|
// Most test binaries currently lack build info, but this should become more
|
|
// permissive once https://golang.org/issue/33976 is fixed.
|
|
return true
|
|
}
|
|
|
|
// Note: info.Main.Version describes the version of the module containing
|
|
// package main, not the version of “the main module”.
|
|
// See https://golang.org/issue/33975.
|
|
return info.Main.Version == "(devel)"
|
|
}
|
|
|
|
func init() {
|
|
packageMainIsDevel = packageMainIsDevelModule
|
|
}
|