Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import third party packages #241

Open
encryptblockr opened this issue Jan 23, 2022 · 8 comments
Open

Cannot import third party packages #241

encryptblockr opened this issue Jan 23, 2022 · 8 comments

Comments

@encryptblockr
Copy link

I am trying to use a third party package within my gophernote and got the following error

repl.go:3:2: error loading package "gorm.io/driver/postgres" metadata, maybe you need to download (go get), compile (go build) and install (go install) it? can't find import: "gorm.io/driver/postgres"

now i docker exec -it gophernotes sh and then ran

/ # go get gorm.io/driver/postgres
# github.com/jackc/pgx/internal/sanitize
go/src/github.com/jackc/pgx/internal/sanitize/sanitize.go:85:15: undefined: strings.ReplaceAll
# gorm.io/gorm/utils
go/src/gorm.io/gorm/utils/utils.go:49:30: reflect.ValueOf(val).IsZero undefined (type reflect.Value has no field or method IsZero)
# github.com/jackc/pgconn
go/src/github.com/jackc/pgconn/errors.go:25:9: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:221:6: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:462:6: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:472:15: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:490:15: undefined: errors.As
# github.com/jackc/pgtype
go/src/github.com/jackc/pgtype/aclitem_array.go:89:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bool_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bpchar_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bytea_array.go:73:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/cidr_array.go:112:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/date_array.go:93:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/enum_array.go:89:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/float4_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/float8_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/hstore_array.go:73:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/hstore_array.go:73:49: too many errors

how do we install third party packages to use in gophernote?

why is there no doc in README about how to do this?!?

@encryptblockr
Copy link
Author

#147

@cosmos72
Copy link
Member

cosmos72 commented Jan 23, 2022

Importing third-party packages is only supported on Linux and Mac OS X - on them, you just need to execute

import "some/package/path"

as described in gomacro README.md
(the interpreter used internally by gophernotes).

There is a way to import them also on Windows, but it's more complicated and it involves recompiling gophernotes (you need to adapt the procedure described at https://github.com/cosmos72/gomacro#other-systems).

If you are using Docker: I am not expert with Docker and cannot help with it - maybe others can (@sbinet ?)

@encryptblockr
Copy link
Author

encryptblockr commented Jan 26, 2022

@cosmos72 @sbinet

Standard packages work fine but does not with third party packages

I have this running inside docker using the latest official docker image gopherdata/gophernotes

Any workaround? am sure there are others using docker that work with codes that require third party packages
Really sad not to be to download packages as it makes gophernotes almost useless now if one cant download packages

@encryptblockr
Copy link
Author

@cosmos72 @sbinet

Seems gophernotes on docker can NOT make any external call period
Any way to fix this or get around this? Without being able to make any external calls, this is almost useless
It is like same thing as golang plyabook now, not being able to make any external calls

@sbinet
Copy link
Member

sbinet commented Feb 6, 2022

what do you mean?
ie: what did you try? and what was the outcome?

@cosmos72
Copy link
Member

cosmos72 commented Feb 6, 2022

The error in the first post above suggests that gophernotes inside Docker is compiled without Go modules support.

If I understand correctly, @sbinet has updated Docker installation procedure to use a recent version of Go toolchain, which should also solve this issue.

Can you try again (following Docker installation procedure, not downloading the pre-built Docker image which quite likely still uses the old Go toolchain) ?

In case you are not using Docker, or if you want to try the plain Windows version of gophernotes, the procedure to import third-party packages from gophernotes on Windows is explained in issue 243

@ChristianKniep
Copy link

Any update on this one. Banging my head against the same issue... :)

@ChristianKniep
Copy link

Even though... When building my own image with the Dockerfile in the repo it works. The DockerHub image is 4 years old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants