Permission Denied: Investigating the Difference Between 'go run' and Makefile Invoking
Encountering permission denied errors while running a Go program through a Makefile can be perplexing. This issue stems from a bug in GNU make or its gnulib component. The root cause lies in the presence of a directory named "go" in the system's PATH that precedes the directory where the actual Go executable resides.
To determine if this is the underlying cause, inspect your system's PATH and check for any directories that contain a subdirectory named "go." For instance, if /usr/bin/go/ exists and /usr/bin is part of your PATH, you may encounter this problem.
To rectify the situation, ensure that any directories containing "go" subdirectories are removed from your PATH. If this is not feasible, you can alternatively use a shell invocation for GNU make's execution. Adding the ; character to the Makefile target will suffice:
run: go run . ;
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3