R/Go integration

Overview

rgo Build Status

Paper nautilus

rgo is an R/Go integration tool — it is only lightly tested so far and should not be used in production.

Install the rgo executable.

$ go get github.com/rgnonomic/rgo

Workflow

With the rgo executable installed, the general work-flow will then proceed something like this.

Initialize the go package module.

$ go mod init example.org/path/to/module

Specify dependency versions using the go tool if needed.

$ go get example.org/path/to/[email protected]

Set up the rgo default configurations and files.

$ rgo init example.org/path/to/pkg

Edit the configuration file, rgo.json, if needed. The rgo.json file corresponds to the following Go struct.

type Config struct {
	// PkgPath is the package import path for the package
	// to be wrapped by rgo. It depends on the go.mod file
	// at the root of the destination rgo package.
	PkgPath string

	// AllowedFuncs is a pattern matching names of
	// functions that may be wrapped. If AllowedFuncs
	// is empty all wrappable functions are wrapped.
	AllowedFuncs string

	// Exported is a pattern matching the Go names of
	// functions that will be exported. If Exported is
	// empty all wrapped functions are exported.
	Exported string

	// Words is a set of known words that can be provided
	// to ensure camel-case to snake case breaks words
	// correctly. If words is nil, "NaN" and "NA" are
	// used. Set words to []string{} to provide an empty
	// set of words.
	Words []string

	// LicenseDir is the directory to put license files
	// when more than one license exists.
	LicenseDir string

	// LicensePattern is the pattern for license file
	// names to check. The pattern is used with the
	// case-insensitive flag.
	LicensePattern string
}
$ vim rgo.json

Generate the wrapper code, documentation and other associated files.

$ rgo build

Make necessary changes to the DESCRIPTION file. If the R package is intended to be packaged license information for dependencies of the Go code will need to be included since Go links statically and the generated .so lib file will be part of the distribution. rgo build will collect all the licenses that it finds in the source module and place them in the LicenseDir directory. You should remove any that are not relevant to the package you are wrapping.

$ vim DESCRIPTION

Then package into a bundle for distribution...

$ git ...

... build and install the R package.

$ R CMD INSTALL .

Type mappings

rgo has builtin type mappings between Go and R types. These are described here.

R Go
scalar integer int, int8, int16, int32/rune, uint, uint8/byte, uint16, uint32
integer vector []int, []int16, []int32/[]rune, []uint, []uint16, []uint32
fixed length integer vector [n]int, [n]int16, [n]int32/[n]rune, [n]uint, [n]uint16, [n]uint32
scalar double float32, float64
double vector []float32, []float64
fixed length double vector [n]float32, [n]float64
scalar complex complex64, complex128
complex vector []complex64, []complex128
fixed length complex vector [n]complex64, [n]complex128
scalar logical bool
logical vector []bool
fixed length logical vector [n]bool
scalar character string (and error in returned values)
character vector []string (and []error in returned values)
fixed length character vector [n]string (and [n]error in returned values)
unnamed list []C
fixed length unnamed list [n]C
named vector map[string]A
named list map[string]C
list struct{...}
raw []int8, []uint8/[]byte
fixed length raw [n]int8, [n]uint8/[n]byte
internal SEXP value unsafe.Pointer

The Go A types correspond to R atomic types.

int, int8, int16, int32/rune, uint, uint8/byte, uint16, uint32, float32, float64, complex64, complex128, bool, string and error

The Go C types correspond all other supported types.

[]T, [n]T, map[string]T and struct{...} where T is any type.

Pointer types are also handled. Currently pointers are indirected so that mutations to pointees do not propagate between the Go and R environments. This behaviour may change for pointers being passed to Go from R.

Go struct tags

Go struct tags with the name rgo may be used to change the R value's name mapping. For example,

type GoType struct {
	Count int `rgo:"number"`
}

will correspond to an R list with a single named element number.

Multiple return values

Go functions returning multiple values will have these values packaged into a list with elements named for the return values in the case of Go functions named returns, or r<n> for unnamed returns where <n> is the index of the return value.

Panics

Go panics are recovered and result in an R error call.

Limitations

R and Go have differences in indexing; R is one-based and Go is zero-based. This means that care needs to be taken when using indexes generated in the other environment.

R lacks 64-bit integers, so rgo will refuse to wrap functions that have 64-bit integer inputs or results (int64 and uint64). It also refuses to wrap function that take or return uintptr values. On Go architectures with 64-bit int and uint types, results are truncated to 32 bits. This behaviour will not change until R gets 64-bit integer types.

R Matrix values are not currently handled and will need to be destructured to a vector and a pair of dimensions (see the matrix example for how to do this).

Currently the extraction of type identities is weaker than it should be. This will be improved.

Data exchange between R and Go depends on Cgo calls and so is not free. The exact performance impact depends on the type due to R's baroque type system and its implementation; briefly though, R vectors that have a direct correspondence with Go scalar types or slices will perform the best (integer and int32/uint32, double and float64, complex and complex128, and raw and int8/uint8). To check the likely performance of data exchange, look at the generated Go code in the src/rgo directory of the package you are building. The generated code is intended to be reasonably human readable.

R does not know how to unload so libraries, so once loaded it is there until the session is restarted.

Input parameter mutation

For types that have direct memory layout equivalents between Go and R (raw and[]int8/[]uint8, integer and []int32/[]uint32, double and []float64, and complex and[]complex128) the vector is passed directly to Go. This means that the Go code can mutate elements. This needs to be considered when writing Go code that works on slices to avoid unwanted mutation of R values that are passed to Go. It can also be used for allocation free work on R vectors. Values passed back to R from Go are copied to satisfy Go's runtime restrictions on pointer passing.

Issues
  • Tests are failing, under Ubuntu 20.04.1 (gollvm)

    Tests are failing, under Ubuntu 20.04.1 (gollvm)

    Hi.

    I am not sure what I am missing - not really dealing with R.

    I was curious to run your tests:

    $ go test ./... ? github.com/rgonomic/rgo [no test files] ok github.com/rgonomic/rgo/internal/camel (cached) ok github.com/rgonomic/rgo/internal/codegen (cached) --- FAIL: TestLicenses (0.19s) license_test.go:66: failed to find Go LICENSE text in GOROOT license_test.go:69: failed to find Go LICENSE path in GOROOT FAIL FAIL github.com/rgonomic/rgo/internal/mod 32.117s

    2020/10/17 19:31:15 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_array_in_0 2020/10/17 19:31:23 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_array_out_0 2020/10/17 19:31:32 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_array_out_named_0 2020/10/17 19:31:41 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_in_0 2020/10/17 19:31:49 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_out_0 2020/10/17 19:31:57 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_out_named_0 2020/10/17 19:32:04 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_slice_in_0 2020/10/17 19:32:04 warning: slice type []bool 2020/10/17 19:32:12 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_slice_out_0 2020/10/17 19:32:19 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/bool_slice_out_named_0 2020/10/17 19:32:26 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_array_in_0 2020/10/17 19:32:34 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_array_out_0 2020/10/17 19:32:42 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_array_out_named_0 2020/10/17 19:32:48 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_in_0 2020/10/17 19:32:54 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_out_0 2020/10/17 19:33:02 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_out_named_0 2020/10/17 19:33:11 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_slice_in_0 2020/10/17 19:33:11 warning: slice type []uint8 2020/10/17 19:33:19 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_slice_out_0 2020/10/17 19:33:26 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/byte_slice_out_named_0 2020/10/17 19:33:31 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_array_in_0 2020/10/17 19:33:37 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_array_out_0 2020/10/17 19:33:43 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_array_out_named_0 2020/10/17 19:33:49 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_in_0 2020/10/17 19:33:57 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_out_0 2020/10/17 19:34:04 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_out_named_0 2020/10/17 19:34:13 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_slice_in_0 2020/10/17 19:34:13 warning: slice type []complex128 2020/10/17 19:34:19 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_slice_out_0 2020/10/17 19:34:28 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex128_slice_out_named_0 2020/10/17 19:34:40 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_array_in_0 2020/10/17 19:34:48 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_array_out_0 2020/10/17 19:34:56 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_array_out_named_0 2020/10/17 19:35:06 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_in_0 2020/10/17 19:35:13 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_out_0 2020/10/17 19:35:21 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_out_named_0 2020/10/17 19:35:27 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_slice_in_0 2020/10/17 19:35:27 warning: slice type []complex64 2020/10/17 19:35:33 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_slice_out_0 2020/10/17 19:35:41 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/complex64_slice_out_named_0 2020/10/17 19:35:48 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_array_in_0 2020/10/17 19:35:58 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_array_out_0 2020/10/17 19:36:11 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_array_out_named_0 2020/10/17 19:36:20 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_in_0 2020/10/17 19:36:30 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_out_0 2020/10/17 19:36:46 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_out_named_0 2020/10/17 19:36:59 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_slice_in_0 2020/10/17 19:36:59 warning: slice type []float32 2020/10/17 19:37:10 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_slice_out_0 2020/10/17 19:37:23 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float32_slice_out_named_0 2020/10/17 19:37:32 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_array_in_0 2020/10/17 19:37:43 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_array_out_0 2020/10/17 19:37:53 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_array_out_named_0 2020/10/17 19:38:04 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_in_0 2020/10/17 19:38:17 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_out_0 2020/10/17 19:38:30 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_out_named_0 2020/10/17 19:38:45 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_slice_in_0 2020/10/17 19:38:45 warning: slice type []float64 2020/10/17 19:38:56 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_slice_out_0 2020/10/17 19:39:06 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/float64_slice_out_named_0 2020/10/17 19:39:16 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_array_in_0 2020/10/17 19:39:24 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_array_out_0 2020/10/17 19:39:34 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_array_out_named_0 2020/10/17 19:39:43 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_in_0 2020/10/17 19:39:53 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_out_0 2020/10/17 19:40:01 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_out_named_0 2020/10/17 19:40:15 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_slice_in_0 2020/10/17 19:40:15 warning: slice type []int16 2020/10/17 19:40:25 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_slice_out_0 2020/10/17 19:40:36 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int16_slice_out_named_0 2020/10/17 19:40:48 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int32_array_in_0 2020/10/17 19:41:03 wrapping: github.com/rgonomic/rgo/internal/pkg/testdata/int32_array_out_0 panic: test timed out after 10m0s

    goroutine 891 [running]: testing.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1664 created by time.goFunc /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/time/sleep.go:167 +0x4d

    goroutine 1 [chan receive, 8 minutes]: testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1215 testing.runTests..func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1485 testing.tRunner /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1163 testing.runTests /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1483 testing.M.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1393 main.main /tmp/go-build/b085/_testmain.go:43

    goroutine 6 [select]: gocommand.runCmdContext /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:204 golang.x2eorg..z2fx..z2ftools..z2finternal..z2fgocommand.Invocation.run /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:190 golang.x2eorg..z2fx..z2ftools..z2finternal..z2fgocommand.Invocation.runWithFriendlyError /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:139 golang.x2eorg..z2fx..z2ftools..z2finternal..z2fgocommand.Runner.runConcurrent /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:96 golang.x2eorg..z2fx..z2ftools..z2finternal..z2fgocommand.Runner.RunRaw /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:71 golang.x2eorg..z2fx..z2ftools..z2fgo..z2fpackages.golistState.invokeGo /home/oceanfish81/rgo/vendor/golang.org/x/tools/go/packages/golist.go:839 golang.x2eorg..z2fx..z2ftools..z2fgo..z2fpackages.golistState.createDriverResponse /home/oceanfish81/rgo/vendor/golang.org/x/tools/go/packages/golist.go:425 packages.goListDriver /home/oceanfish81/rgo/vendor/golang.org/x/tools/go/packages/golist.go:198 packages.defaultDriver /home/oceanfish81/rgo/vendor/golang.org/x/tools/go/packages/packages.go:251 golang.x2eorg..z2fx..z2ftools..z2fgo..z2fpackages.Load /home/oceanfish81/rgo/vendor/golang.org/x/tools/go/packages/packages.go:234 pkg.typesFor /home/oceanfish81/rgo/internal/pkg/types_test.go:80 github.x2ecom..z2frgonomic..z2frgo..z2finternal..z2fpkg.TestAnalyse /home/oceanfish81/rgo/internal/pkg/types_test.go:67 testing.tRunner /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1163 created by testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1214 +0x41c

    goroutine 888 [IO wait]: internal..z2fpoll.runtime_pollWait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/netpoll.go:226 internal..z2fpoll.pollDesc.wait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:87 internal..z2fpoll.pollDesc.waitRead /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:92 internal..z2fpoll.FD.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_unix.go:159 os.File.read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file_posix.go:31 os.File.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file.go:116 bytes.Buffer.ReadFrom /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/bytes/buffer.go:204 io.copyBuffer /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:395 io.Copy /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:368 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:311 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:441 created by os..z2fexec.Cmd.Start /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:440 +0x6fb

    goroutine 890 [syscall]: goroutine in C code; stack unavailable created by golang.x2eorg..z2fx..z2ftools..z2finternal..z2fgocommand.Invocation.run /home/oceanfish81/rgo/vendor/golang.org/x/tools/internal/gocommand/invoke.go:190 +0x8c0

    goroutine 889 [IO wait]: internal..z2fpoll.runtime_pollWait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/netpoll.go:226 internal..z2fpoll.pollDesc.wait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:87 internal..z2fpoll.pollDesc.waitRead /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:92 internal..z2fpoll.FD.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_unix.go:159 os.File.read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file_posix.go:31 os.File.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file.go:116 bytes.Buffer.ReadFrom /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/bytes/buffer.go:204 io.copyBuffer /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:395 io.Copy /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:368 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:311 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:441 created by os..z2fexec.Cmd.Start /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:440 +0x6fb FAIL github.com/rgonomic/rgo/internal/pkg 601.089s go build github.com/rgonomic/rgo/sexp: invalid flag in pkg-config --libs: -Wl,-Bsymbolic-functions panic: test timed out after 10m0s

    goroutine 107 [running]: testing.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1664 created by time.goFunc /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/time/sleep.go:167 +0x4d

    goroutine 1 [chan receive, 9 minutes]: testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1215 testing.runTests..func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1485 testing.tRunner /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1163 testing.runTests /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1483 testing.M.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1393 main.main /tmp/go-build/b088/_testmain.go:43

    goroutine 3 [chan receive]: testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1215 github.x2ecom..z2frgonomic..z2frgo..z2finternal..z2frgo.TestRgo /home/oceanfish81/rgo/internal/rgo/rgo_test.go:55 testing.tRunner /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1163 created by testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1214 +0x41c

    goroutine 105 [syscall]: goroutine in C code; stack unavailable created by testing.T.Run /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/testing/testing.go:1214 +0x41c

    goroutine 106 [IO wait]: internal..z2fpoll.runtime_pollWait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/runtime/netpoll.go:226 internal..z2fpoll.pollDesc.wait /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:87 internal..z2fpoll.pollDesc.waitRead /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_poll_runtime.go:92 internal..z2fpoll.FD.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/internal/poll/fd_unix.go:159 os.File.read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file_posix.go:31 os.File.Read /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/file.go:116 bytes.Buffer.ReadFrom /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/bytes/buffer.go:204 io.copyBuffer /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:395 io.Copy /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/io/io.go:368 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:311 exec.func1 /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:441 created by os..z2fexec.Cmd.Start /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/libgo/go/os/exec/exec.go:440 +0x6fb FAIL github.com/rgonomic/rgo/internal/rgo 602.606s ? github.com/rgonomic/rgo/internal/tool [no test files] ? github.com/rgonomic/rgo/internal/vfs/osfs [no test files] ok github.com/rgonomic/rgo/internal/vfs/txtar (cached)

    Most of them are failing. Please specify what I should provide.

    $ go version go version go1.15.2 gollvm LLVM 12.0.0git linux/amd64

    Thanks

    opened by advancedwebdeveloper 13
  • support 64 bit int using https://github.com/truecluster/bit64

    support 64 bit int using https://github.com/truecluster/bit64

    Background

    rgo has limitation with 64-bit integers because R don't have 64-bit integers.

    Proposal

    https://github.com/truecluster/bit64 package support 64-bit integers in R.

    Potential impact of proposal

    opened by mrchypark 2
  • sexp: remove package

    sexp: remove package

    This package was broken by the removal of undocumented API headers in the R distribution. Sadly this greatly diminishes the value of rgo since the performance of the documented approach requiring interchange via Cgo is significantly worse than the direct memory access that this package provided. It also great reduces the flexibility of operations that could be performed using rgo.

    The change that breaks this is git-svn-id: https://svn.r-project.org/R/[email protected] 00db46b3-68df-0310-9c12-caf00c1e9a41.

    opened by kortschak 1
  • nilable values should should be allowed to be NULL in R calls

    nilable values should should be allowed to be NULL in R calls

    Currently, the R sanity checks on input values confirm that they are the correct type for the underlying Go function. The set-up at the moment doesn't allow for NULL to be used since for example is.vector(NULL) is false. So the checks for nilable values in Go should allow for the values to be NULL from R.

    This shows it's head in the cca example, where the backing function has a nilable weights slice that allows users to optionally weight the data. I had to leave that out of the example because otherwise the weights value has to be given with c(1, 1, ... 1).

    opened by kortschak 1
  • fix vector/list correspondences for non-atomic collections

    fix vector/list correspondences for non-atomic collections

    Currently all []T and map[string]T are converted to/from vectors. For R atomic types, this is correct and it is tested there. For non-atomic types it's not correct and is not tested. For non-atomic types, the R types corresponding to a []T or the map[string]T named equivalent is a list. This is noted in the README as not yet implemented, but put here to track the issue.

    opened by kortschak 1
  • proposal: support R attributes

    proposal: support R attributes

    Background

    R types use attributes in a number of ways that rgo cannot currently replicate without prior work in R (see the matrix handling example). Go doesn't not have dynamic attributes for values, so it would be helpful for rgo to be able to interface between the approaches taken by the two languages.

    Proposal

    I propose that the rgo: struct tag be augmented to add a ,attribute (or ,attr) suffix to allow attributes to be transferred between the languages.

    In the simplest form an example would be how a matrix is passed between R and Go; in R a matrix is a vector with a dims integer vector attribute. This would be written in Go under the proposal as

    type Matrix struct {
        Dims [2]int `rgo:"dims,attribute"`
    }
    

    But this does not capture the vector of matrix elements, so we need to special case R vectors with attributes as structs. To be able to do this we can make a rule that a struct with a single with no ,attribute tag and with at least one ,attribute-tagged field will place the R value in the untagged (or marked with another suffix?) field and the attributes tagged fields, so an R matrix would then be

    type Matrix struct {
        Data     []float64   `rgo:""`
        Dims     [2]int      `rgo:"dims,attribute"`
        DimNames [2][]string `rgo:"dimnames,attribute"`
    }
    

    The correct handling of dimnames in this example depends on presaged changes to type correspondences outlined in 8d0061b9d92c1d98bfc3d5f6212df5a983c25a40 and described in #2, which need to happen anyway to ensure that R's odd approach to nested data structures is considered correctly by Go code.

    The following struct would result in an rgo error and refusal to perform the wrapping.

    type Matrix struct {
        Name     string      `rgo:"name"`
        Data     []float64   `rgo:""`
        Dims     [2]int      `rgo:"dims,attribute"`
        DimNames [2][]string `rgo:"dimnames,attribute"`
    }
    

    Potential impact of proposal

    This will fairly significantly increase the complexity of the initial analysis of structs, however, the benefit outweighs this even if only for the ability to more easily use matrices.

    opened by kortschak 1
Releases(v0.2.1)
Utility to generate tokens to interact with GitHub API via GitHub App integration

GitHub App Authentication for integration with GitHub Introduction GitHub Apps are the officially recommended way to integrate with GitHub because of

GitHub Advanced Security 2 Mar 16, 2022
http integration test framework

go-hit hit is an http integration test framework written in golang. It is designed to be flexible as possible, but to keep a simple to use interface f

Tobias Salzmann 119 Jul 29, 2022
opentracing integration with GORM

gorm-opentracing opentracing support for gorm2. Features Record SQL in span logs. Record Result in span logs. Record Table in span tags. Record Error

null 72 Jul 29, 2022
A demo repository that shows CI/CD integration using DroneCI + ArgoCD + Kubernetes.

CI/CD Demo This is the demo repo for my blog post. This tutorial shows how to build CI/CD pipeline with DroneCI and ArgoCD. In this demo, we use Drone

Hao-Ming, Hsu 40 Jul 29, 2022
A Distributed Continuous Integration System from MongoDB

Evergreen Evergreen is a distributed continuous integration system built by MongoDB. It dynamically allocates hosts to run tasks in parallel across ma

Evergreen 356 Jul 28, 2022
R/Go integration

rgo rgo is an R/Go integration tool — it is only lightly tested so far and should not be used in production. Install the rgo executable. $ go get gith

null 49 Jul 8, 2022
'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.

gotestsum gotestsum runs tests using go test --json, prints formatted test output, and a summary of the test run. It is designed to work well for both

null 1k Jul 30, 2022
Prevent Kubernetes misconfigurations from ever making it (again 😤) to production! The CLI integration provides policy enforcement solution to run automatic checks for rule violations. Docs: https://hub.datree.io

What is Datree? Datree helps to prevent Kubernetes misconfigurations from ever making it to production. The CLI integration can be used locally or in

datree.io 5.8k Aug 4, 2022
A Go language implementation of the proposed ads.cert protocols for integration in programmatic ads solutions.

go-adscert A Go language implementation of the proposed ads.cert protocols for integration in programmatic ads solutions. This repository is a work-in

Curtis Light 3 Jun 4, 2021
A Sample Integration of Google and GitHub OAuth2 in Golang (GoFiber) utilising MongoDB

Go Oauth Server This is sample OAuth integration written in GoLang that also uses MongoDB. This is a sample TODO Application where people can Create a

Hemanth Krishna 8 Apr 25, 2022
Robust framework for running complex workload scenarios in isolation, using Go; for integration, e2e tests, benchmarks and more! 💪

e2e Go Module providing robust framework for running complex workload scenarios in isolation, using Go and Docker. For integration, e2e tests, benchma

null 105 Jul 20, 2022
OpenTelemetry integration for Watermill

Watermill OpenTelemetry integration Bringing distributed tracing support to Watermill with OpenTelemetry.

Voi Technology AB 12 Jul 20, 2022
A crunchyroll api integration in go with included cli

crunchyroll-go A Go library & cli for the undocumented crunchyroll api. You surely need a crunchyroll premium account to get full (api) access. CLI ??

null 5 Jul 24, 2022
Golang Integration Testing Framework For Kong Kubernetes APIs and Controllers.

Kong Kubernetes Testing Framework (KTF) Testing framework used by the Kong Kubernetes Team for the Kong Kubernetes Ingress Controller (KIC). Requireme

Kong 16 Jul 15, 2022
Partial fork of testify framework with allure integration

allure-testify Оглавление Demo Getting started Examples Global environments keys How to use suite Allure info Test info Label Link Allure Actions Step

null 3 Dec 1, 2021
TriggerMesh open source event-driven integration platform powered by Kubernetes and Knative.

TriggerMesh open source event-driven integration platform powered by Kubernetes and Knative. TriggerMesh allows you to declaratively define event flows between sources and targets as well as add even filter, splitting and processing using functions.

TriggerMesh 322 Aug 6, 2022
A mock of Go's net package for unit/integration testing

netmock: Simulate Go network connections netmock is a Go package for simulating net connections, including delays and disconnects. This is work in pro

Lucas Wolf 1 Oct 27, 2021
Simple HTTP integration test framework for Golang

go-itest Hassle-free REST API testing for Go. Installation go get github.com/jefflinse/go-itest Usage Create tests for your API endpoints and run the

Jeff Linse 12 Jan 8, 2022
WIP. Converts Azure Container Scan Action output to SARIF, for an easier integration with GitHub Code Scanning

container-scan-to-sarif container-scan-to-sarif converts Azure Container Scan Action output to Static Analysis Results Interchange Format (SARIF), for

Armel Soro 2 Jan 25, 2022
A sample golang project to demonstrate the integration with rancher pipeline

pipeline-example-go This is a sample golang project to demonstrate the integration with rancher pipeline. Building go build -o ./bin/hello-server Runn

null 0 Oct 30, 2021
Mutagen Compose is a modified version of Docker Compose that offers automated integration with Mutagen.

Mutagen Compose Mutagen Compose is a (minimally) modified version of Docker Compose that offers automated integration with Mutagen. This allows you to

Mutagen 62 Jul 30, 2022
Golang SDK for Splitwise 3rd party integration

Splitwise Golang SDK A community driven Golang SDK for Splitwise 3rd-party APIs. How to use it? You should get the package via go get command: go get

Ahmad Anvari 3 May 27, 2022
Utility to generate tokens to interact with GitHub API via GitHub App integration

GitHub App Authentication for integration with GitHub Introduction GitHub Apps are the officially recommended way to integrate with GitHub because of

GitHub Advanced Security 2 Mar 16, 2022
A best practices Go source project with unit-test and integration test, also use skaffold & helm to automate CI & CD at local to optimize development cycle

Dependencies Docker Go 1.17 MySQL 8.0.25 Bootstrap Run chmod +x start.sh if start.sh script does not have privileged to run Run ./start.sh --bootstrap

Quang Nguyen 4 Apr 4, 2022
Websocket client sample integration (go) for FairOS.

fairos-websocket-client FairOS websocket clients should be an extension on the FairOS OpenAPI specification, with introduction of events for seamless

Fair Data Society 2 Jul 14, 2022
Home Assistant custom integration for e-distribución

DEPRECATED! En primer lugar, gracias a todos por vuestra participación identificando fallos o proponiendo mejoras, pero debido a los últimos movimient

VMG 17 Apr 18, 2022
Bitcoin Core integration/staging tree

Bitcoin Core integration/staging tree https://bitcoincore.org For an immediately usable, binary version of the Bitcoin Core software, see https://bitc

Bitcoin 65.5k Aug 2, 2022
Test-app-url-shortner - A sample url shortener app to test Keploy integration capabilities

test-app-url-shortner A sample url shortener app to test Keploy integration capa

null 1 Jan 23, 2022
Stuff to make standing up sigstore (esp. for testing) easier for e2e/integration testing.

sigstore-scaffolding This repository contains scaffolding to make standing up a full sigstore stack easier and automatable. Our focus is on running on

Ville Aikas 19 Aug 5, 2022