forked from flux-framework/flux-sched
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
22 changed files
with
415 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"name": "Flux Sched Developer Environment", | ||
"dockerFile": "Dockerfile", | ||
"context": "../", | ||
"name": "Flux Sched Developer Environment", | ||
"dockerFile": "Dockerfile", | ||
"context": "../", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
} | ||
} | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
}, | ||
"extensions": [ | ||
"ms-vscode.cmake-tools" | ||
] | ||
} | ||
}, | ||
"postStartCommand": "git config --global --add safe.directory /workspaces/flux-sched" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
set(CUSTOM_GO_PATH "${CMAKE_SOURCE_DIR}/resource/reapi/bindings/go") | ||
set(GOPATH "${CMAKE_CURRENT_BINARY_DIR}/go") | ||
|
||
# This probably isn't necessary, although if we could build fluxcli into it maybe | ||
file(MAKE_DIRECTORY ${GOPATH}) | ||
|
||
# ADD_GO_INSTALLABLE_PROGRAM builds a custom go program (primarily for testing) | ||
function(BUILD_GO_PROGRAM NAME MAIN_SRC CGO_CFLAGS CGO_LIBRARY_FLAGS) | ||
message(STATUS "GOPATH: ${GOPATH}") | ||
message(STATUS "CGO_LDFLAGS: ${CGO_LIBRARY_FLAGS}") | ||
get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE) | ||
add_custom_target(${NAME}) | ||
|
||
# IMPORTANT: the trick to getting *spaces* to render in COMMAND is to convert them to ";" | ||
# string(REPLACE <match-string> <replace-string> <out-var> <input>...) | ||
STRING(REPLACE " " ";" CGO_LIBRARY_FLAGS ${CGO_LIBRARY_FLAGS}) | ||
add_custom_command(TARGET ${NAME} | ||
COMMAND GOPATH=${GOPATH}:${CUSTOM_GO_PATH} GOOS=linux G0111MODULE=off CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS='${CGO_LIBRARY_FLAGS}' go build -ldflags '-w' | ||
-o "${CMAKE_CURRENT_SOURCE_DIR}/${NAME}" | ||
${CMAKE_GO_FLAGS} ${MAIN_SRC} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
DEPENDS ${MAIN_SRC_ABS} | ||
COMMENT "Building Go library") | ||
foreach(DEP ${ARGN}) | ||
add_dependencies(${NAME} ${DEP}) | ||
endforeach() | ||
|
||
add_custom_target(${NAME}_all ALL DEPENDS ${NAME}) | ||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${NAME} DESTINATION bin) | ||
endfunction(BUILD_GO_PROGRAM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory( src ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/flux-framework/flux-sched/resource/reapi/bindings/go | ||
|
||
go 1.19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory( test ) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.