all: remove Go 1.17 build tags / workarounds

related to golang/protobuf#1613

Change-Id: Ie4255c24c1b79b13aab763a75125836191088d26
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/585096
Reviewed-by: Lasse Folger <lassefolger@google.com>
Auto-Submit: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Stapelberg 2024-05-13 15:54:29 +02:00 committed by Gopher Robot
parent f7dca67dc5
commit 15d7b138c5
4 changed files with 3 additions and 22 deletions

View File

@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Go native fuzzing was added in go1.18. Remove this once we stop supporting
// go1.17.
//go:build go1.18
package protojson_test
import (

View File

@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Go native fuzzing was added in go1.18. Remove this once we stop supporting
// go1.17.
//go:build go1.18
package prototext_test
import (

View File

@ -18,7 +18,6 @@ import (
"os"
"os/exec"
"path/filepath"
"reflect"
"regexp"
"runtime"
"runtime/debug"
@ -560,15 +559,9 @@ func race() bool {
if !ok {
return false
}
// Use reflect because the debug.BuildInfo.Settings field
// isn't available in Go 1.17.
s := reflect.ValueOf(bi).Elem().FieldByName("Settings")
if !s.IsValid() {
return false
}
for i := 0; i < s.Len(); i++ {
if s.Index(i).FieldByName("Key").String() == "-race" {
return s.Index(i).FieldByName("Value").String() == "true"
for _, setting := range bi.Settings {
if setting.Key == "-race" {
return setting.Value == "true"
}
}
return false

View File

@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Go native fuzzing was added in go1.18. Remove this once we stop supporting
// go1.17.
//go:build go1.18
package proto_test
import (