You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to make a event-delegate framework for my job, and I want to compare the same method between different receiver, if it's any way to do that? Or if I can get the value of receiver (maybe by reflect) ?
I know func value is not comparable but I'm wondering if there any other way can do that ?
package main
import (
"reflect"
)
typeTEventstruct {
Namestring
}
func (this*TEvent) Changed() {
println(this.Name)
}
funcmain() {
t1:=TEvent{"T1"}
t2:=TEvent{"T2"}
// might use reflect to compare ?tMV1:=reflect.ValueOf(t1.Changed)
tMV1-2:=reflect.ValueOf(t1.Changed)
tMV2:=reflect.ValueOf(t2.Changed)
// Want: compare `t1.Changed` and `t2.Changed` got false,// compare `t1.Changed` and `t1.Changed` got true.
}
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered:
the Go project does not use its bug tracker for general discussion or asking questions about the language. The Github bug tracker is only used for tracking bugs and proposals going through the Proposal Process.
Please see the Questions wiki page; it has a list of good places for asking questions. Thanks!
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xq/b3m9nkcx6jlgmnsvyz8w_05r0000gn/T/go-build427161431=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
I want to make a event-delegate framework for my job, and I want to compare the same method between different receiver, if it's any way to do that? Or if I can get the value of receiver (maybe by reflect) ?
I know func value is not comparable but I'm wondering if there any other way can do that ?
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: