(zilch lang go): document
Change-Id: I6a6a6964558b4fe2f96d78120b2e899f91d48c22
This commit is contained in:
parent
f0ce185d5c
commit
18f2887eba
13 changed files with 457 additions and 96 deletions
|
|
@ -1,3 +1,4 @@
|
|||
;; Routines to locate Go packages in a `<vfs>`.
|
||||
(define-library (zilch lang go package)
|
||||
(import
|
||||
(scheme base)
|
||||
|
|
@ -18,9 +19,9 @@
|
|||
(map go-stdlib-ref '("encoding/json" "fmt" "go/build" "io" "io/fs" "os" "path" "path/filepath" "sort" "strings" "time"))
|
||||
(list (cons "main.go" (zfile (foreign-value "parser_source" nonnull-c-string)))))))
|
||||
|
||||
;; Uses IFD to find each Go package defined inside this virtual filesystem,
|
||||
;; returning a vector containing pairs, mapping each directory to the
|
||||
;; package defined within.
|
||||
;; Finds each Go package defined inside this virtual filesystem,
|
||||
;; and returns a vector containing pairs, mapping the name of each directory to the
|
||||
;; a vector-based structure describing the package defined in said directory.
|
||||
(define (find-packages-inside-vfs vfs)
|
||||
(define input
|
||||
#~,(call-with-port
|
||||
|
|
@ -29,6 +30,6 @@
|
|||
(json-write (vector (cons "GOARCH" (%goarch)) (cons "GOOS" "linux") (cons "files" #$(vfs-to-json (vfs-filter-for-go-package vfs)))) bv)
|
||||
(get-output-bytevector bv))))
|
||||
(define input-file (zfile input))
|
||||
(define store-path (cdar (store-path-for-ca-drv* "find-packages" "x86_64-linux" #~(#$go-import-parser #$input-file) '() '("out"))))
|
||||
(define store-path (cdar (store-path-for-ca-drv "find-packages" "x86_64-linux" #~(#$go-import-parser #$input-file) '() '("out"))))
|
||||
(call-with-port (store-path-open store-path)
|
||||
(lambda (p) (json-read p))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue