pkujhd / goloader

load and run golang code at runtime.
Apache License 2.0
507 stars 59 forks source link

fmt.Println(0) is wrong #11

Closed pkujhd closed 4 years ago

pkujhd commented 4 years ago

testcase:

package main

import (
    "fmt"
)

func LoaderString(value interface{}) bool {
    fmt.Println("LoaderString:", fmt.Sprint(value))
    return false
}

func main() {
    LoaderString(0)
}

result:

pkujhd@pkujhd goloader % ./loader -o test.o
LoaderString: 2339095698830926629
pkujhd commented 4 years ago

golang compile do not allocate memory in objfile when a static variable is equal 0