Invalid assembly code from go build

Why is go not working?

go -version
go version go1.10.3 gccgo (GCC) 8.2.0 linux/arm

Contents of hello.go file:

package main
import “fmt”
func main() {
fmt.Println(“Hello, world.”)
}

When I do

Go build -work hello.go

I get:

pi@raspberrypi-Desktop:~/go/src/github.com/ctday/learning/hello$ go build -work hello.go

WORK=/tmp/go-build950159161

command-line-arguments

/tmp/go-build950159161/b001/_buildid.s: Assembler messages:
/tmp/go-build950159161/b001/_buildid.s:8: Error: junk at end of line, first unrecognized character is ,' /tmp/go-build950159161/b001/_buildid.s:9: Error: junk at end of line, first unrecognized character is,’

The generated assembly file contents:

pi@raspberrypi-Desktop:/tmp/go-build950159161/b001$ less _buildid.s
.section .go.buildid,“e”
.byte 0x31,0x45,0x77,0x53,0x6a,0x55,0x76,0x6d
.byte 0x35,0x36,0x58,0x50,0x54,0x67,0x6a,0x39
.byte 0x34,0x74,0x53,0x42,0x2f,0x31,0x45,0x77
.byte 0x53,0x6a,0x55,0x76,0x6d,0x35,0x36,0x58
.byte 0x50,0x54,0x67,0x6a,0x39,0x34,0x74,0x53
.byte 0x42
.section .note.GNU-stack,"",@progbits
.section .note.GNU-split-stack,"",@progbits

Apparently, the .section lines are invalid.

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