← Back to issue list

Can't redirect the output of go run to a file

View original Github issue

Metadata

Project
rockcraft
Number
#755
Type
issue
State
open
Author
kian99
Labels
Created
Updated
Closed

Current evaluation

go run output redirection produces empty file in rockcraft build environment; user suspects snap confinement. 650 days old, zero comments, no labels, no maintainer response. Go plugin since reworked and stabilized in craft-parts.

Suggested action: needs triage

Reason: No maintainer has ever responded, labelled, or assigned this issue (0 comments, no labels, 650 days old). The go plugin has been significantly reworked in craft-parts (go-use plugin, backstage integration) and the experimental flag was removed in #1194, but there is no concrete evidence the specific go-run-redirect behavior is fixed. A maintainer needs to assess whether this is still reproducible with the current go plugin or whether it is a Go toolchain/snap-confinement issue outside rockcraft's scope.

Impact: 25 Quick Win: 15.0 Staleness: 85 Complexity: 40 Confidence: 50 Support Request: 25

Issue body

### Bug Description When running in the override-build step, the output of `go run` is not being redirected to a file as expected. In my override-build step I am using a go package to do some formatting on a file. As I was typing out this bug report, I realised that I think this is happening because of snap confinement. It feels a bit frustrating to face snap confinement issues while in a build environment. ### To Reproduce Use the rockcraft.yaml below and put an `exit 1` at the start of override-build and run `rockcraft pack --debug`. Then try the following: - go run github.com/openfga/cli/cmd/fga@latest model -h - go run github.com/openfga/cli/cmd/fga@latest model -h > test-file - ls -lah test-file - go install github.com/openfga/cli/cmd/fga@latest - /root/go/bin/fga model -h > test-file - ls -lah test-file On my machine: ``` # go run github.com/openfga/cli/cmd/fga@latest model -h > test-file # ls -lah test-file -rw-r--r-- 1 root root 0 Nov 19 12:31 test-file # /root/go/bin/fga -h > test-file # ls -lah test-file -rw-r--r-- 1 root root 1.5K Nov 19 12:35 test-file ``` As you can see the first attempt results in an empty file (maybe because of snap confinement?) while the second attempt works. ### Environment ``` $ lxc version Client version: 6.1 Server version: 6.1 ``` ### rockcraft.yaml ```yaml name: jimm base: ubuntu@22.04 version: '0.1' summary: Juju Intelligent Model Manager provides a convient way to manage all of your models! description: | JIMM is a Juju controller, used in conjunction with the JaaS dashboard to provide a seamless way to manage models, regardless of where their controllers reside or what cloud they may be running on. license: GPL-3.0 platforms: amd64: parts: ca-certs: plugin: nil overlay-packages: [ca-certificates] builder: plugin: go # https://canonical-craft-parts--694.com.readthedocs.build/en/694/common/craft-parts/reference/plugins/go_plugin.html after: - ca-certs source: . source-type: local build-snaps: - go/1.23/stable build-packages: - git - make build-environment: - GOOS: linux override-build: | set -ex mkdir -p $CRAFT_PART_INSTALL/usr/local/bin make build/server cp ./jimmsrv $CRAFT_PART_INSTALL/usr/local/bin # The location of SQL files isn't configurable right now, as such we just # place it in bin cp -r ./internal/dbmodel/sql $CRAFT_PART_INSTALL/usr/local/bin/sql # Convert the OpenFGA auth model to JSON and place a copy in the ROCK # Used by the charm to apply to the OpenFGA server, not by the container itself mkdir -p $CRAFT_PART_INSTALL/root/openfga/ go install github.com/openfga/cli/cmd/fga@latest go run github.com/openfga/cli/cmd/fga@latest model transform --file ./openfga/authorisation_model.fga --output-format json > $CRAFT_PART_INSTALL/root/openfga/authorisation_model.json exit 1 ``` ### Relevant log output ```shell None ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 15.0
Staleness: 85
Complexity: 40
Confidence: 50
Support Request: 25
needs triage go run output redirection produces empty file in rockcraft build environment; user suspects snap confinement. 650 days old, zero comments, no labels, no maintainer response. Go plugin since reworked and stabilized in craft-parts.
qwen/qwen3.6-35b-a3b
Staleness: 92
Complexity: 40
Confidence: 85
Support Request: 35
close stale Report of go run output redirection failing in Rockcraft build environment, producing empty files. Author suspects snap confinement. Untriaged, inactive for 610 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 45
Confidence: 85
Support Request: 30
close stale User reports go run output redirection fails in rockcraft build environment, producing empty files. Suspects snap confinement. Inactive for 595 days with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 50
Confidence: 85
Support Request: 20
close stale User reports `go run` output redirection fails in `rockcraft` override-build, suspecting snap confinement. Issue is 592 days old with no maintainer response.
qwen3.6-35b-a3b-mtp-q6
Staleness: 88
Complexity: 40
Confidence: 65
Support Request: 55
close stale go run output redirection fails in Rockcraft's override-build step, likely due to snap confinement. Open with zero comments and 573 days of inactivity; requires triage and investigation.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/rockcraft#1194 (confidence 60%)

    Disabled experimental flags for go plugin, indicating the go plugin was stabilized and reworked after this issue was filed

Related issues

No related issues found above the similarity threshold.