Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.devenv
.direnv
.idea/

result
5 changes: 3 additions & 2 deletions err.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package gonix

// #cgo pkg-config: nix-expr-c
// #cgo pkg-config: nix-expr-c nix-main-c
// #include <stdlib.h>
// #include <nix_api_util.h>
// #include <nix_api_expr.h>
// #include <nix_api_value.h>
// #include <nix_api_main.h>
import "C"
import (
"errors"
"fmt"
)

func nixError(err C.int, ctx *Context) error {
func nixError(err C.nix_err, ctx *Context) error {
switch err {
case C.NIX_OK:
return nil
Expand Down
4 changes: 2 additions & 2 deletions external.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ExternalValueProvider interface {
CoerceToString(addContext func(string) error, copyMore, copyToStore bool) (string, error)

// Equal is called for a comparison of two external values. If `other` is not an external
// value, Equal isn't called and instead `false` is always returned.
// cvalue, Equal isn't called and instead `false` is always returned.
Equal(other ExternalValueProvider) bool

// PrintValueAsJSON is called when the value is converted to JSON. The result must
Expand All @@ -72,7 +72,7 @@ type ExternalValueProvider interface {
// PrintValueAsXML(strict, location, copyToStore bool) string
}

// ExternalValue is a wrapper around a go value passed into nix.
// ExternalValue is a wrapper around a go cvalue passed into nix.
type ExternalValue struct {
cev *C.ExternalValue
}
Expand Down
4 changes: 2 additions & 2 deletions external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (v *simpleExternal) Equal(other gonix.ExternalValueProvider) bool {
}

func (v *simpleExternal) PrintValueAsJSON(strict, copyToStore bool) string {
return `{ "value" : "simpleexternal" }`
return `{ "cvalue" : "simpleexternal" }`
}

func ExampleState_NewExternalValue() {
Expand Down Expand Up @@ -91,5 +91,5 @@ func ExampleExternalValueProvider_PrintValueAsJSON() {
}

fmt.Println(res)
// Output: {"value":"simpleexternal"}
// Output: {"cvalue":"simpleexternal"}
}
Loading