1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:18:33 -06:00
go/internal/testenv/testenv_112.go
Bryan C. Mills c17b040389 all: skip tests if required tools are not found
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>
2019-08-30 15:40:57 +00:00

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
}