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
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\LayTsyn\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\LayTsyn\AppData\Local\Temp\go-build3606146757=/tmp/go-build -gno-record-gcc-switches
I expected to see that regardless of calling the value acquisition method (reflect.ValueOf), the result of the comparison would be the same in the two types of program.
func ValueOf¶
func ValueOf(i any) Value
ValueOf returns a new Value initialized to the concrete value stored in the interface i. ValueOf(nil) returns the zero Value.
There is no word here that the transmitted value is being changed. But that seems to be the case. Otherwise, why does calling the information Getter (ValueOf) change the result of the program execution?
The text was updated successfully, but these errors were encountered:
Go version
go1.23.4 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Program1:
Program2:
What did you see happen?
Program1
Output: "pointerErrEmpty == interfaceWithPointer: false"
Program2
Output: "pointerErrEmpty == interfaceWithPointer: true"
What did you expect to see?
I expected to see that regardless of calling the value acquisition method (reflect.ValueOf), the result of the comparison would be the same in the two types of program.
The Go documentation (https://pkg.go.dev/reflect#ValueOf) says:
There is no word here that the transmitted value is being changed. But that seems to be the case. Otherwise, why does calling the information Getter (ValueOf) change the result of the program execution?
The text was updated successfully, but these errors were encountered: