mirror of
https://github.com/google/gops.git
synced 2024-11-27 08:31:17 +02:00
53ee352cc8
Use package debug/buildinfo [1] introduced in Go 1.18 [2] when possible. This should avoid previous issues with rsc.io/goversion where Go processes were no longer listed. [1] https://pkg.go.dev/debug/buildinfo [2] https://go.dev/doc/go1.18#debug/buildinfo For #102 For #159 For #160
19 lines
425 B
Go
19 lines
425 B
Go
// Copyright 2022 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.
|
|
|
|
//go:build !go1.18
|
|
// +build !go1.18
|
|
|
|
package goprocess
|
|
|
|
import goversion "rsc.io/goversion/version"
|
|
|
|
func goVersion(path string) (string, error) {
|
|
versionInfo, err := goversion.ReadExe(path)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return versionInfo.Release, nil
|
|
}
|