vielfrass

Untitled

Feb 16th, 2021
800
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "reflect"
  6.     "runtime"
  7.  
  8.     "github.com/mallvielfrass/coloredPrint/fmc"
  9. )
  10.  
  11. func lol(a ...interface{}) {
  12.     fmt.Println("lol!")
  13. }
  14. func (o object) lol(a ...interface{}) {
  15.     fmt.Println(o.Name)
  16. }
  17. func HelloWorld(a ...interface{}) {
  18.     fmt.Println("Hello, world!")
  19. }
  20. func writer(a ...interface{}) {
  21.  
  22.     if len(a) != 0 {
  23.         for i, s := range a {
  24.             fmt.Println(i, s)
  25.         }
  26.     } else {
  27.         fmt.Println("Hello, world!")
  28.     }
  29. }
  30.  
  31. type object struct {
  32.     Name string
  33. }
  34.  
  35. func Route(fn func(a ...interface{}), a ...interface{}) {
  36.     //  fn.Name()
  37.     name := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
  38.     fmc.Printfln("#rbt (middleware)> #gbt %s()", name)
  39.     fn(a)
  40. }
  41. func main() {
  42.     Route(lol)
  43.     Route(HelloWorld)
  44.     Route(writer, "test")
  45.     o := object{
  46.         Name: "jack",
  47.     }
  48.     Route(o.lol)
  49. }
  50.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×