i want to give some user sudo access from my golang application. but in the sudoers file i saw the line "# This file MUST be edited with the 'visudo' command as root.". because when we edit sudoers file with visudo it will check for syntax error brfore saving the file to avoid misconfiguration of the file because misconfiguration of sudoers file will lead to SUDO Privilege Escalation.
Here my question is how can i edit this file from my golang application safely with visudo's syntax check? or is there any other ways to give sudo access to an user without editing sudoers file?
i was trying to edit /etc/sudoers file from my golang application.