AUR package build fails because it cannot remove build files: Permission denied

Pamac Version

10.2.0-1

Libpamac Version

11.1.0-1

Desktop environment

DE

What's not working

Updating go-yq fails because of wrong file permissions in /var/tmp/pamac-build-<user>/. Some (?) files way down the path only have -r--r--r-- permissions.

How to reproduce?

  • install go-yq
  • (possibly) wait for an update, run pamac update
To build (1):
  go-yq  4.13.0-1  (4.12.2-1)  AUR


Edit build files : [e] 
Apply transaction ? [e/y/N] y


Building go-yq...
==> Making package: go-yq 4.13.0-1 (Sa 18 Sep 2021 13:43:19 CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading yq-4.13.0.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
100   121  100   121    0     0    510      0 --:--:-- --:--:-- --:--:--   512
100  127k    0  127k    0     0   163k      0 --:--:-- --:--:-- --:--:--  461k
==> Validating source files with sha256sums...
    yq-4.13.0.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/custom_completions_test.go': Permission denied
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/projects_using_cobra.md': Permission denied
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/github.com/spf13/cobra@v1.1.3/command_win.go': Permission denied
[ … a whole lot of files … ]
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b/yaml.go': Permission denied
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b/suite_test.go': Permission denied
rm: cannot remove '/var/tmp/pamac-build-mcn/go-yq/src/gopath/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20210107192922-496545a6307b/readerc.go': Permission denied

==> ERROR: An unknown error has occurred. Exiting...
Error: Failed to build go-yq