Replace ioutil.WriteFile with os.WriteFile since the former has been
deprecated since go1.16 and simply calls the latter.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
Go 1.19 includes some changes to gofmt which intend to make lists and
heading clearer when rendered (https://go.dev/doc/go1.19). This commit
is the result of running the new gofmt and manually fixing some of it.
This was necessary because the new gofmt assumed lines beginning w/ tabs
to start lists or examples. While this is often true in our codebase,
we occasionally also use tabs to indent the lines after a TODO or FIXME
prefix or in yaml (e.g., excerpts of a snap.yaml). This meant that a lot of the
reformatted comments were broken and had to be fixed manually.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
Context
On Sept 21st, Microsoft anounced systemd support for WSL 2 ([see anouncement](https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/)), and Ubuntu-Preview already ships with systemd enabled by default.
Changes
Snap now works on WSL 2. Hence some of the current system checks in snapd have to be updated in response.
Bugfixes
This PR fixes:
- [#1991823](https://bugs.launchpad.net/snapd/+bug/1991823) WSL detection is now incorrect / inappropriate
- [#1991826](https://bugs.launchpad.net/snapd/+bug/1991826) snapd is intentionally broken under WSL and shouldn't be
* release: Implemented WLS 1/2 distinction
* syscheck: enabled snapd on WSL 2
* snapd-apparmor: Applied distiction, split tests
* Made WSL1 check more robust
* release: Removed redundant isWSL
* snapd-apparmor: WSL2 has internal policy
* release: Strenghtened detection of WSL1 vs. WSL2
* cmd/snap: Allowed snap on WSL2
* release: getting filesystem type with syscal
* release: added unit test for filesystemRootType
* release: use Assert to check errors
as we usually do
Co-authored-by: Samuele Pedroni <pedronis@lucediurna.net>