Created
May 18, 2023 04:48
-
-
Save StephanieSunshine/17cb94bdb20acd2b44d762681c80f93a to your computer and use it in GitHub Desktop.
Golang Reflect Help Wanted -- How do I dereference this reflect.Value?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Output without trying to call the Function: | |
1 | |
F1_Init | |
F1 Comming Online | |
(SerenadeMi.Entry) { | |
FnNum: (uint) 1, | |
FnName: (string) (len=5) "hello", | |
SDesc: (string) (len=11) "Print Hello", | |
Ldesc: (string) (len=16) "Test Print Hello", | |
Fn: (func(*interface {}) error) 0x1024b3e30 | |
} | |
Output with trying to call the Function: | |
../../../go/pkg/mod/github.com/!b!bs!mi/[email protected]/functions.go:23:9: res.Fn undefined (type any has no field or method Fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module newapp | |
go 1.19 | |
require github.com/BBsMi/SerenadeMi v0.0.0-20230518042544-972f9953932e | |
require github.com/davecgh/go-spew v1.1.1 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
// "fmt" | |
// "reflect" | |
smi "newapp/menu" | |
"github.com/BBsMi/SerenadeMi" | |
) | |
func main() { | |
// fmt.Println("Hello") | |
// smi.F1(nil) | |
i := smi.Inits{} | |
SerenadeMi.Init(&i) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment