Skip to content

Commit

Permalink
reapi: updates for golang
Browse files Browse the repository at this point in the history
Problem: Go bindings can be more friendly to Go developers
Solution: This includes docstring changes, the main module path
to be under flux-framework, returning Go error instead of int,
and updating tests to return nil (no error) instead of 0. The
module path is fixed from a development variant to a
flux-framework one. Finally, it fixes the Go bindings to
use a struct instead of passing around a ctx variable. Our
goal with these final changes to the Go module is to make
the code more friendly to future go developers.

Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Sep 6, 2023
1 parent bae56f3 commit 667e86e
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 275 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ compile_flags.txt
# Rules to ignore auto-generated test harness scripts
test_*.t
!/src/bindings/python/test_commands/test_runner.t

# Go
resource/reapi/bindings/go/src/test/main
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,37 @@ be set to the same prefix as was used to install the target flux-core.

For example, if flux-core was installed in `$FLUX_CORE_PREFIX`:

```
```bash
./configure --prefix=${FLUX_CORE_PREFIX}
make
make check
make install
```

To build go bindings, you will need go (tested with 1.19.10) available, and then:

```bash
export WITH_GO=yes
./configure
make
```

To run just one test, you can cd into t

```bash
$ ./t9001-golang-basic.t
ok 1 - match allocate 1 slot: 1 socket: 1 core (pol=default)
ok 2 - match allocate 2 slots: 2 sockets: 5 cores 1 gpu 6 memory
# passed all 2 test(s)
1..2
```

To run full tests (more robust and mimics what happens in CI) you can do:

```bash
make check
```

##### Flux Instance

The examples below walk through exercising functioning flux-sched modules (i.e.,
Expand Down
2 changes: 1 addition & 1 deletion resource/reapi/bindings/go/src/fluxcli/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/cmisale/flux-sched/resource/hlapi/bindings/go/src/fluxcli
module github.com/flux-framework/flux-sched/resource/reapi/bindings/go/src/fluxcli

go 1.19
Loading

0 comments on commit 667e86e

Please sign in to comment.