How to resolve error : ” no buildable Go source files in “

Sometimes when we try to compile an unknown go package, we can see an error like “no buildable Go source files in”, the possible solution could be,

  1. Check if the package which shows error “no buildable Go source files in” is using C code, like
    import "C"

    in the source file, in that case, we might see an error, when we try to compile as “go build”, most probably when we try to cross compile that code,

    The solution is to add “CGO_ENABLED=1” while building the code,

    CGO_ENABLED=1 go build

Leave a Comment