spark-operator icon indicating copy to clipboard operation
spark-operator copied to clipboard

`go test ./...` fails.

Open TiansuYu opened this issue 2 years ago • 1 comments

I am trying to build a sparkctl CLI tool locally but failed to do so, following this guide. The error message is

# golang.org/x/sys/unix
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:29:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: too many errors

So I tried to run the test command go test ./... described here and received the following error message:

# golang.org/x/sys/unix
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:29:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: too many errors
ok  	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1beta2	0.362s
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/batchscheduler/volcano [build failed]
ok  	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/config	0.201s
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/controller/scheduledsparkapplication [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/controller/sparkapplication [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/util [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/webhook [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/webhook/resourceusage [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/sparkctl/cmd [build failed]
FAIL	github.com/GoogleCloudPlatform/spark-on-k8s-operator/test/e2e [build failed]

I have no prior experience with go and have to say it would hard for me to debug these errors. Hopefully someone here can point me where could I fix this.

The platform is Macbook Pro M1 with OS Montery 12.4. The go is installed via brew.

TiansuYu avatar Jun 26 '22 10:06 TiansuYu

The M1 is arm64 arch, not amd64. Maybe https://github.com/golang/go/issues/37181 is related to your issue? Doesn't hurt to read this article: https://dev.to/tidalmigrations/how-to-cross-compile-go-app-for-apple-silicon-m1-27l6

Specifically, you want to give GOOS=darwin GOARCH=arm64 go test ./... a try. (You should include those vars on any go commands you run.)


EDIT @TiansuYu can you please add the "arm64 arch" information in your issue title?

tafaust avatar Jul 05 '22 08:07 tafaust

Thanks for the clarification. This issue is out of date, so I will close it now.

TiansuYu avatar Oct 19 '22 07:10 TiansuYu