Golang in directly execute code (Evaling)

//https://play.golang.org/p/Jr0fprGwuvR]

package main

import (
    "fmt"
)
const EAX = 0x01


func returnStr() string {
    return "(EAX<<EAX<<EAX<<EAX<<EAX<<EAX<<EAX^EAX)"
}
func main() {
    fmt.Println(returnStr()) 
    fmt.Println((EAX<<EAX<<EAX<<EAX<<EAX<<EAX<<EAX^EAX)) //65
}

Hi guys,

This function returns as string but still output as string. What can I do to make the output 65?

Hi. Go don’t substitute constant names inside strings with their value. You must do the calculation and then convert it to a string:

https://play.golang.org/p/CYcEhuJYz-i

1 Like

If you return a string your going to get a string.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.