Errors trying to use external pkg z3

92 views
Skip to first unread message

Kenneth Miller

unread,
May 22, 2024, 10:30:00 AM5/22/24
to golang-nuts

but when I go run . I get

main.go:5:2: package z3 is not in std

the offending line is 

import "z3"

can someone help me please? I'm sure this has been asked before but I couldn't find it

robert engels

unread,
May 22, 2024, 10:38:54 AM5/22/24
to Kenneth Miller, golang-nuts
What are you trying to run? z3 is a library.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d46b52fb-fa96-4544-914a-42bf83d75322n%40googlegroups.com.

robert engels

unread,
May 22, 2024, 10:46:30 AM5/22/24
to Kenneth Miller, golang-nuts
If it is your own code, you have to use


or you need a special go.mod file.

Brian Candler

unread,
May 22, 2024, 11:12:58 AM5/22/24
to golang-nuts
It's because the name of the module is "github.com/aclements/go-z3/z3", not "z3"

Only packages in the standard library have short names, like "fmt", "strings" etc.

Kenneth Miller

unread,
May 22, 2024, 11:26:54 AM5/22/24
to golang-nuts
I tried that, same error

Brian Candler

unread,
May 22, 2024, 12:39:05 PM5/22/24
to golang-nuts
* Start in an empty directory
* Run "go mod init example"
* Create your main.go with that import statement in it
* Run:

go mod tidy
go run .

Kenneth Miller

unread,
May 22, 2024, 4:27:03 PM5/22/24
to golang-nuts
I changed the terminal and then it worked.
Reply all
Reply to author
Forward
0 new messages