Skip to content

Commit be46d45

Browse files
committed
update to latest zmq4 and latest gomacro: adds ability to import local packages
given a relative or absolute filesystem path
1 parent c9673a2 commit be46d45

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/gopherdata/gophernotes
33
go 1.13
44

55
require (
6-
github.com/cosmos72/gomacro v0.0.0-20220109145729-f19a149b3738
7-
github.com/go-zeromq/zmq4 v0.13.0
6+
github.com/cosmos72/gomacro v0.0.0-20220530072503-c719ab5c40fc
7+
github.com/go-zeromq/zmq4 v0.14.1
88
github.com/gofrs/uuid v4.2.0+incompatible
99
)

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
github.com/cosmos72/gomacro v0.0.0-20220109145729-f19a149b3738 h1:ytvTPy+n9k+0Txa1pkgfW9ACxuDnJslOECC83O1gC9Y=
2-
github.com/cosmos72/gomacro v0.0.0-20220109145729-f19a149b3738/go.mod h1:60O8/t169OwS8bX0BeWSjxlGGb/I5cGYc6Brt5rWDL0=
1+
github.com/cosmos72/gomacro v0.0.0-20220530072503-c719ab5c40fc h1:JTky1C2BMhJ+Rwf8IFFQNwrOQntLrQhp2QImELC2jLo=
2+
github.com/cosmos72/gomacro v0.0.0-20220530072503-c719ab5c40fc/go.mod h1:60O8/t169OwS8bX0BeWSjxlGGb/I5cGYc6Brt5rWDL0=
33
github.com/go-zeromq/goczmq/v4 v4.2.2 h1:HAJN+i+3NW55ijMJJhk7oWxHKXgAuSBkoFfvr8bYj4U=
44
github.com/go-zeromq/goczmq/v4 v4.2.2/go.mod h1:Sm/lxrfxP/Oxqs0tnHD6WAhwkWrx+S+1MRrKzcxoaYE=
5-
github.com/go-zeromq/zmq4 v0.13.0 h1:XUWXLyeRsPsv4KlKMXnv/cEm//Vew2RLuNmDFQnZQXU=
6-
github.com/go-zeromq/zmq4 v0.13.0/go.mod h1:TrFwdPHMSLG7Rhp8OVhQBkb4bSajfucWv8rwoEFIgSY=
5+
github.com/go-zeromq/zmq4 v0.14.1 h1:DlHlNzzOeB8mvC5YkoAraiCToA7MfDK5j+iQhVp/uo0=
6+
github.com/go-zeromq/zmq4 v0.14.1/go.mod h1:mfhCJhT9+zDabvUOd3/gvV08Nqny6pmUabKi224/2Ps=
77
github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0=
88
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
99
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=

kernel.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,7 @@ func runKernel(connectionFile string) {
135135

136136
// Inject the "display" package to render HTML, JSON, PNG, JPEG, SVG... from interpreted code
137137
// maybe a dot-import is easier to use?
138-
display, err := ir.Comp.ImportPackageOrError("display", "display")
139-
if err != nil {
140-
log.Print(err)
141-
}
138+
display := importPackage(ir, "display", "display")
142139

143140
// Inject the stub "Display" function. declare a variable
144141
// instead of a function, because we want to later change
@@ -245,6 +242,17 @@ func runKernel(connectionFile string) {
245242
}
246243
}
247244

245+
func importPackage(ir *interp.Interp, path string, alias string) *interp.Import {
246+
packages, err := ir.ImportPackagesOrError(
247+
map[string]interp.PackageName{
248+
path: interp.PackageName(alias),
249+
})
250+
if err != nil {
251+
log.Print(err)
252+
}
253+
return packages[path]
254+
}
255+
248256
// prepareSockets sets up the ZMQ sockets through which the kernel
249257
// will communicate.
250258
func prepareSockets(connInfo ConnectionInfo) (SocketGroup, error) {

0 commit comments

Comments
 (0)