// p.Query is "select * from o_settings('get_by_id', 
'{"id":8,"changes":null,"search_criteria":null}');" 


logme(p.Query())
// you see in console:
//LOGME: p.Query() = "select * from o_settings('get_by_id', 
'{"id":8,"changes":null,"search_criteria":null}');"
//


func logme(nup string) {
 //for debugging 
 _, file, no, ok := runtime.Caller(1)

 if !ok {
      log.Println(nup)
 }

 f, err := os.Open(file)
 try(err)
 defer f.Close()

 scanner := bufio.NewScanner(f)
 try(err)
 try(scanner.Err())

 re := regexp.MustCompile(`logme\((.+)\)`)

 var rowNum int
 for scanner.Scan() {
   rowNum ++
   if rowNum == no {
     nupName := re.FindStringSubmatch(scanner.Text())[1] //берем второе 
попадание
     log.Printf(`LOGME: %s = "%s" %s`, nupName, nup, "\n")
   }
  }
}













суббота, 13 октября 2012 г., 20:12:42 UTC+3 пользователь Dumitru Ungureanu 
написал:
>
> From what I read, it's not possible, but I thought I double check, just to 
> make sure, can we get variables names?
>
> http://play.golang.org/p/O6b0aMqq2Z
>
> I'd expect this instead:
> "variable x has value 0"
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to