Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove purego fallbacks #325

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmp/export_unsafe.go → cmp/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !purego
// +build !purego

package cmp

import (
"reflect"
"unsafe"
)

const supportExporters = true

// retrieveUnexportedField uses unsafe to forcibly retrieve any field from
// a struct such that the value has read-write permissions.
//
Expand Down
16 changes: 0 additions & 16 deletions cmp/export_panic.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !purego
// +build !purego

package value

import (
Expand Down
34 changes: 0 additions & 34 deletions cmp/internal/value/pointer_purego.go

This file was deleted.

3 changes: 0 additions & 3 deletions cmp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,6 @@ func (cm comparer) String() string {
// In other cases, the cmpopts.IgnoreUnexported option can be used to ignore
// all unexported fields on specified struct types.
func Exporter(f func(reflect.Type) bool) Option {
if !supportExporters {
panic("Exporter is not supported on purego builds")
}
return exporter(f)
}

Expand Down
2 changes: 1 addition & 1 deletion cmp/report_reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
break
}
sf := t.Field(i)
if supportExporters && !isExported(sf.Name) {
if !isExported(sf.Name) {
vv = retrieveUnexportedField(v, sf, true)
}
s := opts.WithTypeMode(autoType).FormatValue(vv, t.Kind(), ptrs)
Expand Down