riscv64: fix argument count check in spec.go
The code was panicking instead of reporting an error when an incorrect
number of arguments were passed.
Change-Id: I1ed8c94cedc8501160dbc65cdfc28badf67bf4f0
Reviewed-on: https://go-review.googlesource.com/c/arch/+/698895
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Carlos Amedee <carlos@golang.org>
diff --git a/riscv64/riscv64spec/spec.go b/riscv64/riscv64spec/spec.go
index b65ea69..5b80c86 100644
--- a/riscv64/riscv64spec/spec.go
+++ b/riscv64/riscv64spec/spec.go
@@ -68,7 +68,7 @@
log.SetFlags(0)
log.SetPrefix("riscv64spec: ")
- if len(os.Args) < 1 {
+ if len(os.Args) < 2 {
log.Fatal("usage: go run spec.go <opcodes-repo-path>")
}
extensionsPath := filepath.Join(os.Args[1], "extensions")