The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
mokeychan

请教各位,关于 Go 的反射调用方法返回值的问题, error 怎么获取?!

  •  
  •   mokeychan · Nov 20, 2018 · 2886 views
    This topic created in 2807 days ago, the information mentioned may be changed or developed.

    func a() ([]byte, error){

    // 反射 要执行的函数为 b()
    result = funcValue.Call(params)
    return result[0].Bytes(),new err(result[1].String()) // 这样嚒?
    

    }

    func b(parmam...) ([]byte, error) { //... return []byte, err }

    2 replies    2018-11-21 11:41:33 +08:00
    icexin
        1
    icexin  
       Nov 21, 2018   ❤️ 1
    result[1].Interface().(error)
    soulsxd
        2
    soulsxd  
       Nov 21, 2018   ❤️ 1
    retVal[1].Interface().(error)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5273 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:41 · PVG 16:41 · LAX 01:41 · JFK 04:41
    ♥ Do have faith in what you're doing.