Last active
June 11, 2020 17:48
-
-
Save waynr/a53b3f4ab3a80f76bea99c5ae705803d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group gotools { | |
perm { | |
admin { | |
uid = UID; | |
gid = UID; | |
} | |
task { | |
uid = UID; | |
gid = UID; | |
} | |
} | |
cpu { | |
cpu.shares = 256; | |
} | |
memory { | |
# limit to 6GB | |
memory.limit_in_bytes = 6442450944; | |
} | |
} | |
~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cgexec \ | |
-g memory,cpu:gotools \ | |
$GOPATH/bin/gopls.real "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt install cgroup-tools | |
$ mv cgconfig.conf /etc/cgconfig.conf | |
$ sed -i -e 's|UID|$(id -u)|' /etc/cgconfig.conf | |
$ sudo cgconfigparser -l /etc/cgconfig.conf | |
$ mv $GOPATH/bin/gopls $GOPATH/bin/gopls.real | |
$ ln -sf /path/to/gopls.bash $GOPATH/bin/gopls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also worth noting, to get the most mileage out of this you will probably have to configure your editor to pass the
--remote=auto
option to gopls.