"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Why Am I Getting \"Permission Denied\" Errors When Running Go Programs Through a Makefile?

Why Am I Getting \"Permission Denied\" Errors When Running Go Programs Through a Makefile?

Published on 2024-11-15
Browse:960

Why Am I Getting \

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 . ;
Release Statement This article is reprinted at: 1729668363 If ​​there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

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