What is wrong with my code!!!!!!!!
Mar 13, 2014 at 12:44pm UTC
lol, I need a forum for Go. Anyway, I was writing some go today, and I decided to test it on the Go Playground. the code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
package Micro-Bug
import (
"fmt"
"debug/pe"
"os"
)
// ReturnPEBody() returns the ".text" section of the executable
func ReturnPEBody(file string) {
exe, err := Open(file)
if err != nil {
fmt.Println("Bad Executable" )
os.Exit(1)
}
code := exe.Section(".text" )
if code == nil {
fmt.Println("Invalid Executable" )
os.Exit(1)
}
}
Upon run, I get the following message:
prog.go:5: imported and not used: "debug/pe"
prog.go:11: undefined: Open
[process exited with non-zero status]
Program exited.
If you need a link to the code:
http://play.golang.org/p/YfqaAq7ul3
p.s. I do at some point plan to make a website including a forum for go. I understand most of the basics: syntax, loops, branching, etc. I just need to review go-routines, and get some standard lib research done.
Mar 13, 2014 at 1:22pm UTC
I don't really know Go, but from the surrounding code did you mean something like this? (line 11):
exe, err := pe.Open(file)
Mar 14, 2014 at 11:56am UTC
oops -_- thanks
Topic archived. No new replies allowed.