find_program(GO go)

add_custom_command(
    OUTPUT gonex
    COMMAND ${GO} build
    DEPENDS gonex.go
)

add_custom_target(gonex_target ALL
    DEPENDS gonex
)

find_program(GO go)

add_custom_command(
    OUTPUT gonex${CMAKE_EXECUTABLE_SUFFIX}
    COMMAND ${GO} build
    DEPENDS gonex.go
)

add_custom_target(gonex_target ALL
    DEPENDS gonex${CMAKE_EXECUTABLE_SUFFIX}
)

Use correct executable suffix for gonex
Use correct executable suffix for gonex
