GO Application needs root rights

I have a snap that will need to reboot the system via a command. When issuing the command, the application throws an error stating: “operation not permitted”.

To reboot the machine, I am using:
err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)

How do I give my snap rights to do this command? Is there a way to give sudo privileges to snaps?

Here is my yaml:

name: cm # you probably want to 'snapcraft register <name>'
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
   cm:
     command: cm
     daemon: simple
     restart-condition: always
     plugs: [network-bind]

parts:
  cm:
    # See 'snapcraft plugins'
    plugin: dump
    source: ./dist

you need to use the shutdown plug in your app and use a dbus call to do the actual reboot like:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true

(though i’m still not sure this will allow you to reboot as non-root, you have to try)