Go - Functions - 5 (variadic function, defer)



  • Declare variadic function
  • Variadic function parameter type is .... Different from slice.
  • Action can be defered with a defer statement. Defered function will be called after function contains the defer statement has been done (after return value).
  • Any number of defer can be declared, it will be executed by reversed defer order.

  • Need extra parentheses when defer a function. Ex. defer f()()
  • A defered function can observe the function’s result.
  • A defered function can even change the result. Ex.

沒有留言:

張貼留言

Lessons Learned While Benchmarking vLLM with GPU

Recently, I benchmarked vLLM on a GPU to better understand how much throughput can realistically be expected in an LLM serving setup. One ...