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

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

  •  
  •   mokeychan · Nov 20, 2018 · 2962 views
    This topic created in 2872 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   ·   Privacy   ·   Solana   ·   2438 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:27 · PVG 10:27 · LAX 19:27 · JFK 22:27
    ♥ Do have faith in what you're doing.